Answer Posted / chaitanya
The man page shows it as "struct sockaddr *my_addr". The sockaddr struct though is just a place holder for the structure it really wants. You have to pass different structures depending on what kind of socket you have. For an AF_INET socket, you need the sockaddr_in structure. It has three fields of interest:
sin_family
Set this to AF_INET.
sin_port
The network byte-ordered 16 bit port number
sin_addr
The host's ip number.
This is a struct in_addr,
which contains only one field,
s_addr which is a u_long.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why does the sockets buffer fill up sooner than expected?
Why do I get EPROTO from read()?
What is a socket file?
Is tcp or unix socket faster?
How can I tell when a socket is closed on the other end?
What is a socket connection?
How many sockets can a cpu have?
What exactly is a socket?
What's the difference between impact sockets and regular sockets?
What is active unix domain sockets?
How can I write a multi-homed server?
What's the difference between a socket and a port?
How are unix domain sockets implemented?
What is a deep well socket?
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?