Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:ad0e6c7f41a95cff6b774113c9d2690206ee1db7
  • Code
  • Branches (39)
  • Releases (0)
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.51
    • refs/tags/1.52
    • refs/tags/1.53
    • refs/tags/1.60
    • refs/tags/1.70
    • refs/tags/1.83
    • refs/tags/1.84
    • refs/tags/1.84-4
    • refs/tags/1.84-6
    • refs/tags/1.84-6.1
    • refs/tags/R-2.10.0
    • refs/tags/R-2.10.1
    • refs/tags/R-2.11.0
    • refs/tags/R-2.11.1
    • refs/tags/R-2.12.0
    • refs/tags/R-2.12.1
    • refs/tags/R-2.12.2
    • refs/tags/R-2.13.0
    • refs/tags/R-2.13.1
    • refs/tags/R-2.13.2
    • refs/tags/R-2.14.0
    • refs/tags/R-2.14.1
    • refs/tags/R-2.14.2
    • refs/tags/R-2.15.0
    • refs/tags/R-2.15.1
    • refs/tags/R-2.15.2
    • refs/tags/R-2.15.3
    • refs/tags/R-2.7.1
    • refs/tags/R-2.7.2
    • refs/tags/R-2.8.0
    • refs/tags/R-2.8.1
    • refs/tags/R-2.9.0
    • refs/tags/R-2.9.1
    • refs/tags/R-2.9.2
    • refs/tags/R-3.0.0
    • refs/tags/R-3.0.1
    • refs/tags/R-3.0.2
    • refs/tags/R-3.0.3
    No releases to show
  • 55869cd
  • /
  • R
  • /
  • socketRequest.R
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
content badge
swh:1:cnt:29596370c933094a25ec192eb82939519cfa887f
directory badge
swh:1:dir:6cfc417cbefe106a504a52f3f77021d8792f25b7
revision badge
swh:1:rev:97a6960daa89dd92588807451cfbaf5800c4ae5e
snapshot badge
swh:1:snp:ad0e6c7f41a95cff6b774113c9d2690206ee1db7

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 97a6960daa89dd92588807451cfbaf5800c4ae5e authored by Jochen Knaus on 24 April 2010, 00:00:00 UTC
version 1.84
Tip revision: 97a6960
socketRequest.R
#*****************************************************************************
# Functions for handling the connection to the controlling webserver.
#
# Base socketrequest follows code from post on R-help:
# http://tolstoy.newcastle.edu.au/R/devel/06/07/6196.html
#
# PARAMETER: Array|List Arguments (all Entries must be in format "name=val")
# RETURN:    Array result from webserver
# THROWS:    Exception Connection Error
#*****************************************************************************
connectWebserver <- function( call.args ) {
  host <- "www.imbi.uni-freiburg.de"
  path <- "/bib/bib.pl"

  # Parameters for the call.
  dat  <- paste( call.args, collapse="&", sep="" )

  len <- length( strsplit(dat,"")[[1]] )

  request <- paste( "POST ", path, " HTTP/1.0\nHost: ", host,
                    "\nReferer:\n",
                    "Content-type: application/x-www-form-urlencoded\n",
                    "Content-length: ", len,
                    "\nConnection: Keep-Alive\n\n", dat, sep="" )

  sock <- NULL      # Needed in catch-Block for disconnect
  readSock <- ""

  # Connect. Catch exceptions regarding to connection errors.
  exception <- try( {
         sock <- socketConnection( host=host, port=80,
                                   server=FALSE, blocking=TRUE )
  
         write( request, sock )
         socketSelect( list( sock ) )
         readSock <- readLines( sock )
         close( sock )
       }, silent=FALSE )

  if( inherits( exception, "try-error" ) ) {
    cat( "Error connecting to: ", host, path, dat, "\n" )

    # If socket exists, close it.
    if( sock != NULL ) close( sock )

    stop()
  }

  return( readSock )
}

##connectWebserver( c( "kat=ben", "cmd=list", "usr=jo", "usr_sel=JO" ) )

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API