Skip to main content

addresses

An address comprises of three components:

  • the address type, followed by a :
  • zero or more required address parameters separated by :
  • zero or more address options separated by ,

An example address can be "UDP4:www.example.com:8000"

Address Type

An address type specifies the kind of communication that will happen, and can be something like: * TCP4 * TCP4-LISTEN, a tcp server * TCP6 * UDP_RECVFROM, receives a single UDP packet and sends back some packets * UDP4 * FD, raw file descriptor, a number representing a file descriptor * GOPEN, a generic file path

Notice that some addresses have aliases, for example: * - is the equivalent of STDIO * TCP is the equivalent of TCP4

From the man page of socat we can also find out the other aliases.

Also sometimes just by specifying the address, the type can be inferred; for example if we start our address with a /, most probably it will be a GOPEN.

Address Options

An address type can be further enhanced by specifying options after the address.

For example, an address like: TCP4:www.example.com:80:retry=5, will mean that the tcp connection will be retried 5 times.

Another common option is the fork, for example, we may see: TCP4-LISTEN:www.example.com:80,fork In this case one of the addresses will listen for connection and for each connection it will for a child, so that it will be able to handle more connections.