make-passive-socketPortable Socketsremote-hostname-and-portopen-connectionGoTo Top

open-connection   host port => socket-stream[Generic Function]

Open a socket-stream connection to server host.

Method signatures

open-connection  (host integer) port => socket-stream
open-connection  (host string) port => socket-stream

Package   :portable-sockets

Module   :portable-sockets

Arguments and values

host     A 32-bit internet address or a string specifying the remote host
port     An integer or a string specifying the service port
socket-stream     A socket stream

A socket stream.

A host string can be either a host name or a “dotted” IP address, such as "".

String values available for specifying port are found in the operating system's services file and labeled as being tcp services. On Unix systems, the services file is /etc/services. On Windows, it is the file services in the Windows directory.

See also

Open a socket connection to the GBBopen Project web server:

  > (open-connection "" 80)
  #<socket stream connected from localhost/51756 to>

Connections should always be closed using close (from both sides) when they are no longer needed to free up operating-system resources.

The GBBopen Project

make-passive-socketPortable Socketsremote-hostname-and-portopen-connectionGoTo Top