table of contents
socket_connect4(3) | Library Functions Manual | socket_connect4(3) |
NAME¶
socket_connect4 - attempt to make a TCP connectionSYNTAX¶
#include <socket.h>DESCRIPTION¶
socket_connect4 attempts to make a connection from TCP socket s to TCP port port on IP address ip.- •
- 0, to indicate that the connection succeeded (and succeeded immediately, if the socket is non-blocking)
- •
- -1, setting errno to error_inprogress or error_wouldblock, to indicate that the socket is non-blocking
- •
- -1, setting errno to something else, to indicate that the connection failed (and failed immediately, if the socket is non-blocking).
EXAMPLE¶
#include <socket.h>
int s;
char ip[4];
uint16 p;
s = socket_tcp4();
socket_bind4(s,ip,p);
socket_connect4(s,ip,p);