%SS_CONNECT

Connect sockets or establish peer address (IPv4)

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SS_CONNECT(socket, in_port, in_addr[, in_timeout])

Return value

status

Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS_CONNECT below. (n)

Arguments

socket

A descriptor of an open socket created by %SS_SOCKET. (i4)

in_port

The internet port of a target socket. (i4)

in_addr

The IPv4 address of a target socket. (i4)

in_timeout

(optional) The number of seconds to wait for a connection before %SS_CONNECT returns with an SS_ETIMEDOUT error. If not specified, the function will wait indefinitely for either a successful connection or an error to occur. (n)

Discussion

%SS_CONNECT connects two stream sockets or establishes a peer address for a datagram socket.

If socket is a stream socket, %SS_CONNECT attempts to make a connection to the target stream socket specified by in_port and in_addr. A stream socket client does not have to call %SS_BIND to bind a local address before calling %SS_CONNECT, because %SS_CONNECT automatically binds a random TCP port greater than 1023 to the socket before making a connection.

If socket is a datagram socket, %SS_CONNECT specifies the peer where datagrams will be sent or received on subsequent %SS_SEND and %SS_RECV calls.

Error codes returned by %SS_CONNECT

See the Socket Errors table for additional information about these errors.

SS_EADDRINUSE

SS_EADDRNOTAVAIL

SS_EBADF

SS_ECONNREFUSED

SS_ECONNRESET

SS_EDESTADDRREQ

SS_EINTR

SS_EISCONN

SS_EMFILE

SS_ENETDOWN

SS_ENETUNREACH

SS_ENOBUFS

SS_ENOTSOCK

SS_ETIMEDOUT

SS_EUNKNOWN

SS_NOTINITIALISED