Xref: utzoo comp.unix.questions:16994 comp.protocols.tcp-ip:8743 comp.unix.wizards:18701 Path: utzoo!attcan!telly!lethe!torsqnt!jarvis.csri.toronto.edu!mailrus!wuarchive!udel!haven!h.cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!kannan From: kannan@cerc.wvu.wvnet.edu (R. Kannan) Newsgroups: comp.unix.questions,comp.protocols.tcp-ip,comp.unix.wizards Subject: How to handle connection time outs + host address compatibility ... Keywords: socket, ETIMEDOUT, RESET BY PEER + gethostid, gethostbyname .... Message-ID: <237@cerc.wvu.wvnet.edu.edu> Date: 22 Sep 89 14:02:22 GMT Sender: news@cerc.wvu.wvnet.edu Followup-To: comp.unix.questions Lines: 45 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