How to handle connection time outs + host address compatibility ...
R. Kannan
kannan at cerc.wvu.wvnet.edu
Sat Sep 23 00:02:22 AEST 1989
Hai
We would like to seek the advise on two issues:
Problem 1:
What is the bext way to handle errno 61 => ETIMEDOUT,
error => connection timed out.
At the present we are closing the socket and reopening if errno == 61.
This also led to errno 48 and 54 which are
#define EADDRINUSE 48 /* Address already in use */
#define ECONNRESET 54 /* Connection reset by peer */
What are the several options available if one desires to send the
message anyway!
Simple sample code would help.
Problem 2:
"gethostid" returns a "long", the id of the processor.
"gethostbyname" returns a pointer to "struct hostent", with two fields
of relevance => "h_addr" and "h_length"
After an "accept" call, the address of the peer is placed in the
sockaddr_in.sin_addr.s_addr field.
1. Are the results returned by gethostid, gethostbyname and accept
calls compatible.
2. What are the necessary htonl, ntohs conversion
required.
3. Atleast in the AF_INET domain, can one assume that the
host length will be == sizeof(long or u_long)?
Simple sample code would help.
Thank you very much for your time.
--kannan
More information about the Comp.unix.wizards
mailing list