socket TCP UDP
Create a datagram (i.e., UDP) or stream (i.e., TCP) type socket. See function NetSock_Open() for more information.
Files
net_bsd.h/net_bsd.c
Prototype
int socket (int protocol_family, int sock_type, int protocol);
Arguments
protocol_family
Socket protocol family:
PF_INET
Internet Protocol version 4 (IPv4).
sock_type
Socket type:
SOCK_DGRAM
Datagram-type socket.
SOCK_STREAM
Stream-type socket.
protocol
Socket protocol:
0
Default protocol for socket type.
IPPROTO_UDP
User Datagram Protocol (UDP).
IPPROTO_TCP
Transmission Control Protocol (TCP).
Returned Value
Socket descriptor/handle identifier, if no error(s).
-1, otherwise.