HP Rp7410 BSD Sockets Interface Programmer's Guide - Page 94
When to Bind Socket Addresses
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 94 highlights
Using Internet Datagram Sockets Writing the Server and Client Processes Parameter Description of Contents INPUT Value s addr addrlen socket descriptor of local socket socket address length of socket address socket descriptor of socket to be bound pointer to address to be bound to s size of struct sockaddr_in_address Function result: 0 if bind is successful, -1 if failure occurs. Example: struct sockaddr_in myaddr; ... bind (s, &myaddr, sizeof(struct sockaddr_in)); When to Bind Socket Addresses The client and server process should bind socket addresses after the socket is created and before any other BSD Sockets system calls. Refer to the bind(2) man page for more information on bind. 94 Chapter 4
94
Chapter 4
Using Internet Datagram Sockets
Writing the Server and Client Processes
Function result:
0 if bind is successful, –1 if failure occurs.
Example:
struct sockaddr_in myaddr;
...
bind (s, &myaddr, sizeof(struct sockaddr_in));
When to Bind Socket Addresses
The client and server process should bind socket addresses after the
socket is created and before any other BSD Sockets system calls. Refer to
the
bind(2)
man page for more information on
bind
.
Parameter
Description of Contents
INPUT Value
s
socket descriptor of local
socket
socket descriptor of
socket to be bound
addr
socket address
pointer to address to be
bound to s
addrlen
length of socket address
size of struct
sockaddr_in_address