top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Handle Negative Test Cases in TCP socket programming?

+2 votes
680 views

For An Example:
I have Socket-Programming where server is connected to 5 clients and it continuously sends and receives to all the clients.
Now, If one of the client looses the network or in whatever the case one of the client fails then master will also fail and because of it all other client will also be failed.

posted May 7, 2015 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
its very difficult to comment without seeing the code, in client server model this does not happen so its a coding issue?
Ok See.. In TCP 1 client is connected to server ok..?
Now.. somehow that client turned off or its process got killed then how Server will get to know about it?
In my case Server is not getting any information when Client got killed or get away so when server tries to send some message to that client then it is failing. (Showing Error)
fd will fail or return error, but it is difficult to comment without code.

Similar Questions
+1 vote

Is it right that it is used to bind Port number with IP?
If it is, then What is the need of binding it? and Why it is not present in UDP?
And also, What is the use of listen(5) ?
Does it mean that server can be connected maximum to 5 client? or it means that if server is busy with other client then 5 more client can be in queue.?
and also, What is the use of select() ?
As far as i know it is used when we want to monitor continuously input/output for that particular file descriptor.
is it correct?
If yes, then why it is used only when accepting connection request from multiple client.?

0 votes

is it for No of connection can be accepted?
or is it for no of client can be in queue while SFD is busy..?

i have kept 0 as an argument in listen, still it is taking 10 connection..
but if i remove listen then it is showing an error..

Can anybody please help in this?

Thanks in advance

+2 votes

As per my understanding Receive system calls will be a blocking call of the code... it will not go ahead unless it receives the response from client .. my question is how would i set time in that? i want my code should wait only for few seconds then it has to come out from that

+1 vote

In my testing, I found that when i send packets of bytes 1000-5000 bytes from my sender, they get assembled/bundled at receiver with sizes 8000-14000 bytes. I checked the wireshark capture to confirm this.

I have 2 questions:
1) Who bundles these packets in between, receiver receives these and I use select() to detect data and call recvmsg api ?.

2) When packets of lengths increase at receiver, I implemented partial reception so that 'recvmsg' returns partial data also. In this case after some time, recvmsg call returns EAGAIN with 0 bytes. The connection with peer is still up, because peer is still sending packets, why is recvmsg call returing error with EAGAIN ?.

...