1828544 Members
2908 Online
109982 Solutions
New Discussion

soket programming with C

 
suranji
Advisor

soket programming with C

I tested C socket client and server programs and run them on UNIX machines. ( server program in hpux 11.00 and client on SCO unix). It can communicate properly and can write data from client to server. But if I remove the network connection between client and server the program is not giving any error message and terminate the programm as it wrote data succesfully.

If anybody can explain me how it happen and handle network breakdowns in client server programs with C , it will be a great help

-suranji
suranji
2 REPLIES 2
Magdi KAMAL
Respected Contributor

Re: soket programming with C

Hi Suranji,

This is a normal behavior ( because your tcp ip stack is still there ).

But when the client start writting to the socket then it will notify that the connection is lost ( by timeout ).

If you want to have an iimediate error, just stop the netd process then the server process will detect this failure immediatly ( by the listen() function ).

Magdi
James R. Ferguson
Acclaimed Contributor

Re: soket programming with C

Hi:

I would expect this kind of behavior when there is a "catastrophic" loss of connection.

For a understanding, see my comments, Carsten Krege's and Rick Jones' in this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xc56a46ff9277d511abcd0090277a778c,00.html

The link that Carsten offers is quite good.

...JRF...