PDA

View Full Version : Socket TimeOut



Guest.Visitor
01-01-1995, 02:00 AM
I'm communicating as a client with a piece of hardware via sockets using ILE RPG and, for the most part, everything is fine. However, testing has revealed that, in certain situations, when the host becomes unavailable, my read socket command ( eval rc=read(sd, ...) ) will lock up the client. I can't seem to find any information on how to establish time out values that will return control to my RPG program when the read command doesn't respond in a reasonable time. Any ideas? Thanks for the help... Perry

tdaly@sddsystems.com
07-21-2000, 06:11 AM
Instead of using read(...) use select(...) I don't have access to the 400 right this minute so I can't give a more complete answer, so here's from memory. Select() takes four parameters, three are pointers to sets of socket descriptors - sockets ready to be read, sockets ready to be written to, and sockets in an error state, and the fourth is the time-out value. You can use this to simultaneously wait on input from multiple sockets. Hope this gets you going in the right direction.