(Strings)
Socket address strings consist of two parts as follows: transport://address
. The transport specifies the underlying transport protocol to use. The meaning of the address part is specific to the underlying transport protocol.
- TCP transport mechanism:
'tcp://127.0.0.1:65000'
When binding a TCP socket, address of the formtcp://interface:port
should be used. Port is the TCP port number to use. Interface is either:IPv4
orIPv6
address of a local network interface, or DNS name of the remote box. It is possible to use named interfaces likeeth0
. For more info see nanomsg docs. - in-process transport mechanism:
'inproc://bar'
Theinproc
transport allows messages between threads or modules inside a process. In-process address is an arbitrary case-sensitive string preceded byinproc://
protocol specifier. All in-process addresses are visible from any module within the process. They are not visible from outside of the process. The overall buffer size for an inproc connection is determined byrcvbuf
socket option on the receiving end of the connection.sndbuf
is ignored. In addition to the buffer, one message of arbitrary size will fit into the buffer. That way, even messages larger than the buffer can be transfered via inproc connection. - inter-process transport mechanism:
'ipc:///tmp/foo.ipc'
Theipc
transport allows for sending messages between processes within a single box. The nanomsg implementation uses native IPC mechanism provided by the local operating system and the IPC addresses are thus OS-specific. On POSIX-compliant systems, UNIX domain sockets are used and IPC addresses are file references. Note that both relative (ipc://test.ipc
) and absolute (ipc:///tmp/test.ipc
) paths may be used. Also note that access rights on the IPC files must be set in such a way that the appropriate applications can actually use them. On Windows, named pipes are used for IPC. The Windows IPC address is an arbitrary case-insensitive string containing any character except for backslash: internally, addressipc://test
means that named pipe\\.\pipe\test
will be used.