Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
status = %SS2_BIND(socket, in_port, in_addr6)
Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS2_BIND below. (n)
A descriptor of an open socket created by %SS_SOCKET. (i4)
The local internet port to associate with the socket or 0 (zero). (i4)
The local IPv6 address to associate with the socket. ([#]byte)
%SS2_BIND binds a name to an unbound socket. In_port and in_addr6 are used to name it.
If in_port is zero, a random port greater than 1023 is assigned. (Clients typically specify zero, while servers specify well-known ports.)
Unlike %SS_BIND, the in_addr6 argument in %SS2_BIND does not support the define IN_ADDR_ANY. This define allows any suitable network interface to be used for sending or receiving data, which can simplify programming in the presence of multihomed hosts. In synsock.def, IN_ADDR_ANY is mapped to 0. To achieve the same effect with %SS2_BIND, you will need to programmatically set each element of the byte array to 0. For example:
record addr ,[#]byte val ,i4 proc addr = new byte for val from 1 thru 16 addr[val] = 0
There is also an example of this in the IPv6 example.
A connection-oriented client does not need to call %SS2_BIND for a socket if it wishes to use a random port and any address, because %SS2_CONNECT automatically performs this type of bind.
See the Socket Errors table for additional information about these errors.