HP Rp7410 BSD Sockets Interface Programmer's Guide - Page 152
Creating Sockets
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 152 highlights
Using UNIX Domain Datagram Sockets Writing the Server and Client Processes Writing the Server and Client Processes This section discusses the calls your server and client processes must make. Creating Sockets Both processes must call socket to create communication endpoints. socket and its parameters are described in the following table. Include files: System call: #include #include s = socket(af, type, protocol) int af, type, protocol; Parameter Description of Contents INPUT Value af type protocol address family socket type underlying protocol to be used AF_UNIX SOCK_DGRAM 0 (default) Function result: socket number (HP-UX file descriptor) if successful, -1 if socket call fails. Example: #include #include ... s = socket(AF_UNIX, SOCK_DGRAM, 0) When to Create Sockets The server or client process should create sockets before any other BSD Sockets system calls. Refer to the socket(2) man page for more information on socket. 152 Chapter 7