#include <dolphin/socket.h>
int SOConnect ( int s, const void* sockAddr );
SOConnect() attempts to make a connection on a socket. If the socket has not already been bound to a local address, SOConnect()
binds it to an address which is unused and local.
For
SO_SOCK_STREAM (TCP) sockets, SOConnect() normally
blocks until the connection is established. SOConnect() returns as
quickly as possible if the socket is set to the nonblocking mode with
SOFcntl().
For SOCK_DGRAM (UDP) sockets, SOConnect() sets the
socket's peer address, and no connection is made. The peer address identifies where all datagrams are sent on subsequent
SOSend() functions, and limits the
remote sender for subsequent SORecv()
functions. If sockAddr is a null address for the
protocol, the socket's peer address is reset.
s |
The socket descriptor. |
sockAddr |
A pointer to a socket address structure containing the peer address. |
| zero | Succeeded. |
SO_EAFNOSUPPORT |
Non-supported address family. |
SO_EALREADY |
Connection is being established asynchronously for the nonblocking socket. |
SO_EBADF |
Bad socket descriptor. |
SP_ECONNREFUSED |
Connection refused. |
SP_ECONNRESET |
Connection reset. |
SO_EINPROGRESS |
Connection will be established asynchronously for the nonblocking socket. |
SO_EINVAL |
Invalid operation. |
SO_EISCONN |
Socket is already connected. |
SO_ENETDOWN |
Local network interface is down. |
SO_ENETRESET |
Socket library is not initialized. |
S0_ENETUNREACH |
Unreachable. |
SO_ENOBUFS |
Insufficient resources. |
SO_ETIMEDOUT |
Timed out. |
Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.