I need some ideas on where to start looking.
I have a client/server app I'm testing. Most of the work is done in the client. The server simply waits for a command then immediately sends a response, the server is a stub.
Both use the same NetworkStream for sending/receiving.
The client has 2 threads; the main thread and a second thread with a stream.Read() which waits for server responses. Client sends the first command (BIND) and immediately gets a response. 15 seconds later client sends second command (HEARTBEAT) and immediately gets a response. 15 seconds later client again sends HEARTBEAT. I can see the server sending the response but can't see it being received by client.
As there is nothing else going on and the client receives the first HEARTBEAT response what could possibly happen that stops it reading the second HEARTBEAT response?
Heres the line that the client hangs on...
Expand|Select|Wrap|Line Numbers
- int bytesRead = networkStream.Read(buf, bufIndex, buf.Length - bufIndex);
Expand|Select|Wrap|Line Numbers
- public void PduReceived(IPdu pdu)
- {
- log.Debug("*** Received " + pdu);
- IPdu response = ...;
- byte[] bs = response.GetBytes();
- log.Debug("Sending " + response + ", " + bs.Length + "bytes");
- stream.Write(bs, 0, bs.Length);
- stream.Flush();
- }