Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

socket_connect6(3) [debian man page]

socket_connect6(3)					     Library Functions Manual						socket_connect6(3)

NAME
socket_connect6 - attempt to make a TCP connection SYNTAX
#include <socket.h> int socket_connect6(int s, const char ip[16], uint16 port,uint32 scope_id); DESCRIPTION
socket_connect6 attempts to make a connection from TCP socket s to TCP port port on IP address ip. The meaning of scope_id is dependent on the implementation and IPv6 IP. On link-local IPv6 addresses it specifies the outgoing interface index. The name (e.g. "eth0") for a given interface index can be queried with getifname. scope_id should normally be set to 0. socket_connect6 may return o 0, to indicate that the connection succeeded (and succeeded immediately, if the socket is non-blocking) o -1, setting errno to error_inprogress or error_wouldblock, to indicate that the socket is non-blocking o -1, setting errno to something else, to indicate that the connection failed (and failed immediately, if the socket is non-blocking). When a background connection succeeds or fails, s becomes writable; you can use socket_connected to see whether the connection succeeded. If the connection failed, socket_connected returns 0, setting errno appropriately. Once a TCP socket is connected, you can use the read and write system calls to transmit data. You can call socket_connect6 without calling socket_bind6. This has the effect as first calling socket_bind6 with IP address :: and port 0. EXAMPLE
#include <socket.h> int s; char ip[16]; uint16 p; s = socket_tcp6(); socket_bind6(s,ip,p); socket_connect6(s,ip,p,0); SEE ALSO
socket_connect4(3), socket_getifname(3) socket_connect6(3)

Check Out this Related Man Page

udp(7)							 Miscellaneous Information Manual						    udp(7)

NAME
udp - Internet user datagram protocol (UDP) SYNOPSIS
#include <sys/socket.h> #include <netinet/in.h> The following is the socket call for AF_INET sockets: s = socket(AF_INET, SOCK_DGRAM, 0); The following is the socket call for AF_INET6 sockets: s = socket(AF_INET6, SOCK_DGRAM, 0); DESCRIPTION
UDP is a simple, unreliable datagram protocol that is used to support the SOCK_DGRAM abstraction for the Internet Protocol family. UDP sockets are connectionless, and are normally used with the sendto() and recvfrom() functions, though the connect() function may also be used to fix the destination for future packets, in which case the recv() or read() and send() or write() functions may be used. UDP address formats are identical to those used by TCP. In particular, UDP provides a port identifier in addition to the normal Internet address format. Note that the UDP port space is separate from the TCP port space (that is, a UDP port may not be "connected" to a TCP port). In addition, IPv4 broadcast packets may be sent (assuming the underlying network supports this) by using a reserved "broadcast address"; this address is network interface dependent. There is no broadcast address in IPv6. Options at the IP transport level may be used with UDP; see the ip() reference page. ERRORS
If a socket operation fails, errno may be set to one of the following values: An attempt was made to create a socket with a port that has already been allocated. An attempt was made to create a socket with a network address for which no network interface exists. The socket is already connected. This error occurs when trying to establish connection on a socket or when trying to send a datagram with the desti- nation address specified. The system ran out of memory for an internal data structure. The destination address of a datagram was not specified, and the socket has not been connected. RELATED INFORMATION
Functions: getsockopt(2), recv(2), send(2), socket(2) Files: netintro(7), inet(7), ip(7) delim off udp(7)
Man Page