
DEFUN("OPEN-NAMED-SOCKET",object,fSopen_named_socket,SI,1,1,0 ,OI,OO,OO,OO,
"Open a socket on PORT and return (cons fd portname) where file descriptor is a small fixnum which is the write file descriptor for the socket.  If PORT is zero do automatic allocation of port")
DEFUN("CLOSE-FD",object,fSclose_fd,SI,1,1,0 ,OI,OO,OO,OO,
      "Close the file descriptor FD")
DEFUN("CLOSE-SD",object,fSclose_sfd,SI,1,1,0 ,OO,OO,OO,OO,
      "Close the socket connection sfd")
DEFUN("ACCEPT-SOCKET-CONNECTION",object,fSaccept_socket_connection,
      SI,1,1,0 ,OO,OO,OO,OO,
      "Given a NAMED_SOCKET it waits for a connection on this and returns (list* named_socket fd name1) when one is established")
DEFUN("HOSTNAME-TO-HOSTID",object,fShostname_to_hostid,SI,1,1,
      0 ,OO,OO,OO,OO,"")
DEFUN("GETHOSTNAME",object,fSgethostname,SI,0,0,0 ,OO,OO,OO,OO,
      "Returns HOSTNAME of the local host")
DEFUN("HOSTID-TO-HOSTNAME",object,fShostid_to_hostname,SI,
      1,10,0 ,OO,OO,OO,OO,"")
DEFUN("CHECK-FD-FOR-INPUT",int,fScheck_fd_for_input,
      SI,2,2,0 ,II,IO,OO,OO,

"Check FD a file descriptor for data to read, waiting TIMEOUT clicks for data to become available.  Here there are INTERNAL-TIME-UNITS-PER-SECOND in one second.  Return is 1 if data available on FD, 0 if timeout reached and -1 if failed.")
DEFUN("CLEAR-CONNECTION",int,fSclear_connection,SI,1,1,0 ,II,OO,OO,OO,
      "Read on FD until nothing left to read.  Return number of bytes read")
DEFUN("CONNECTION-STATE-FD",int,fSconnection_state_fd,SI,1,1,0 ,IO,OO,OO,OO,"")
DEFUN("OUR-WRITE",int,fSour_write,SI,3,3,0 ,IO,OI,OO,OO,"")
DEFUN("OUR-READ-WITH-OFFSET",int,fSour_read_with_offset,SI,5,5,0 ,
      IO,OI,II,OO,
      "Read from STATE-FD into string BUFFER putting data at OFFSET and reading NBYTES, waiting for TIMEOUT before failing")
DEFUN("PRINT-TO-STRING1",object,fSprint_to_string1,SI,3,3,0 ,OO,OO,OO,OO,
      "Print to STRING the object X according to CODE.   The string must have fill pointer, and this will be advanced.")
DEFUN("SET-SIGIO-FOR-FD",object,fSset_sigio_for_fd,SI,1,1,0 ,OI,OO,OO,OO,"")
DEFUN("RESET-STRING-INPUT-STREAM",object,fSreset_string_input_stream,SI,4,4,0 ,OO,OI,IO,OO,
      "Reuse a string output STREAM by setting its output to STRING and positioning the ouput/input to start at START and end at END")
DEFUN("CHECK-STATE-INPUT",int ,fScheck_state_input,SI,2,2,0 ,IO,IO,OO,OO,
      "")
DEFUN("CLEAR-CONNECTION-STATE",int,fSclear_connection_state,
      SI,1,1,0 ,IO,OO,OO,OO,
      "Read on FD until nothing left to read.  Return number of bytes read")