ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am writing a server, and because it is going to be used in distributed enviornment, it should be robus. SO i am trying to
incorporate all error handling in it. I am encountering following problems.
#1 read from server;
#2 read from terminal(take input)
#3 write to the server;
#4 write to the client;
#5 read from the client;
scenario is like this:
a) client is blocked in line #2. server is blocked in line #5.and suddenly client crashes(ctrl+c). As expected server reads
EOF from the socket, but continue to operate (plz dont ask why, i want to have SIGPIPE in write only). It continues to write
without error first time(because upto this time only FIN has arrived to this socket), and even continues to read from the client(line #5,it is returning 0,its ok). no problem upto this point.
now again when server wants to write to the socket(line#4), it recieves SIGPIPE and process exits.(no problem, because
according to stevens- an attempt to write on the socket, which has recieved RST , will cause SIGPIPE).
but real problem start now- Above scenario is when i am running server and client both on local system. If i try to run server and client in 2 distantly separated systems, server continues to write 8-10 times on the socket, even after getting FIN on the socket.
i think, RST packet that is sent by the closed client( when attempted to write into it), is taking time to reach to the servera
nd because server didn't recieve RST, it continues to write to the socket, irrespective of the fact that it has closed.
can any one plz tell something about the solution.