|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What happens to debugger here?highlighted in yellow from the debugger, I step forward and nothing happens. The yellow highlighted block goes away and the while loop is no longer executed. The code is on a second thread. After stepping forward, focus returns to the application or main form. There are no errors or exceptions. While True Try If networkStream.CanWrite And networkStream.CanRead Then networkStream = tcpClient.GetStream() Dim bytes(tcpClient.ReceiveBufferSize) As Byte networkStream.Read(bytes, 0, tcpClient.ReceiveBufferSize) I did this change to see exactly which part of the above line was causing the problem. The debugger does the same thing on the last line here. Dim mysize As Integer = CInt(tcpClient.ReceiveBufferSize) networkStream.Read(bytes, 0, mysize) Any idea how I can trouble shoot this? Why does the debugger just suddenly go away? Thanks, Brett Brett,
Remember that NetworkStream.Read() is a blocking call. When NetworkStream.Read() blocks, the debugger cannot continue because it's waiting for the Read() call to complete. Are you sure that data is read at all? Regards, -Adam. Brett wrote: Show quoteHide quote > I walk through the following code and when I reach the last line, which is > highlighted in yellow from the debugger, I step forward and nothing happens. > The yellow highlighted block goes away and the while loop is no longer > executed. The code is on a second thread. After stepping forward, focus > returns to the application or main form. There are no errors or exceptions. > > While True > Try > > If networkStream.CanWrite And networkStream.CanRead Then > > networkStream = tcpClient.GetStream() > > Dim bytes(tcpClient.ReceiveBufferSize) As Byte > networkStream.Read(bytes, 0, > tcpClient.ReceiveBufferSize) > > > I did this change to see exactly which part of the above line was causing > the problem. The debugger does the same thing on the last line here. > > Dim mysize As Integer = > CInt(tcpClient.ReceiveBufferSize) > networkStream.Read(bytes, 0, mysize) > > Any idea how I can trouble shoot this? Why does the debugger just suddenly > go away? > > Thanks, > Brett > > I'm not sure the data is read. Shouldn't it be read if the debugger comes
back? How do I tell? Why would it start doing this all of the sudden? I do get data back from the Listener but that was before this started happening. How can I be sure the problem is on the client or listener side? Thanks, Brett Show quoteHide quote "Adam Goossens" <adam.gooss***@gmail.com> wrote in message news:%23eRK6kaQFHA.2356@TK2MSFTNGP14.phx.gbl... > Brett, > > Remember that NetworkStream.Read() is a blocking call. When > NetworkStream.Read() blocks, the debugger cannot continue because it's > waiting for the Read() call to complete. > > Are you sure that data is read at all? > > Regards, > -Adam. > > Brett wrote: >> I walk through the following code and when I reach the last line, which >> is highlighted in yellow from the debugger, I step forward and nothing >> happens. The yellow highlighted block goes away and the while loop is no >> longer executed. The code is on a second thread. After stepping >> forward, focus returns to the application or main form. There are no >> errors or exceptions. >> >> While True >> Try >> >> If networkStream.CanWrite And networkStream.CanRead Then >> >> networkStream = tcpClient.GetStream() >> >> Dim bytes(tcpClient.ReceiveBufferSize) As Byte >> networkStream.Read(bytes, 0, >> tcpClient.ReceiveBufferSize) >> >> >> I did this change to see exactly which part of the above line was causing >> the problem. The debugger does the same thing on the last line here. >> >> Dim mysize As Integer = >> CInt(tcpClient.ReceiveBufferSize) >> networkStream.Read(bytes, 0, mysize) >> >> Any idea how I can trouble shoot this? Why does the debugger just >> suddenly go away? >> >> Thanks, >> Brett Hi Brett,
It's probably a good bet that if the debugger can't advance past that line, then no data is coming in. If you're expecting data to be coming in at a constant rate, it sounds like a problem with the server. If the debugger steps to the next line, one of two things has happened: 1) Data was read without problem, or, 2) The Read() call has returned 0 (zero) indicating that all data has been read and the remote host has shut down the connection. Since neither of those two is happening, it is fair enough to assume that your listener is waiting for data to be received, but none is being sent. You might want to try stepping through your server code as well. If you step through both of them at once you might be able to find the point where something isn't quite right. Let me know how you go. Regards, -Adam. Brett wrote: Show quoteHide quote > I'm not sure the data is read. Shouldn't it be read if the debugger comes > back? How do I tell? > > Why would it start doing this all of the sudden? I do get data back from > the Listener but that was before this started happening. How can I be sure > the problem is on the client or listener side? > > Thanks, > Brett The server is performing fine. I have the same client app there and it
works ok with the server. Send/receive is fine. How do I debug two applications at the same time? Two instances of VS.NET? Thanks, Brett Show quoteHide quote "Adam Goossens" <adam.gooss***@gmail.com> wrote in message news:%23IfPuKkQFHA.2136@TK2MSFTNGP14.phx.gbl... > Hi Brett, > > It's probably a good bet that if the debugger can't advance past that > line, then no data is coming in. If you're expecting data to be coming in > at a constant rate, it sounds like a problem with the server. > > If the debugger steps to the next line, one of two things has happened: > 1) Data was read without problem, or, > 2) The Read() call has returned 0 (zero) indicating that all data has been > read and the remote host has shut down the connection. > > Since neither of those two is happening, it is fair enough to assume that > your listener is waiting for data to be received, but none is being sent. > > You might want to try stepping through your server code as well. If you > step through both of them at once you might be able to find the point > where something isn't quite right. > > Let me know how you go. > Regards, > -Adam. > > > Brett wrote: >> I'm not sure the data is read. Shouldn't it be read if the debugger >> comes back? How do I tell? >> >> Why would it start doing this all of the sudden? I do get data back from >> the Listener but that was before this started happening. How can I be >> sure the problem is on the client or listener side? >> >> Thanks, >> Brett Hi Brett,
> Spot on. Run your server in one instance, your client in another, set > How do I debug two applications at the same time? Two instances of VS.NET? > some breakpoints and let them go. Has this problem always occurred, or is it a recent thing? Regards, -Adam.
sql Server not found
Paging by example - help - still no luck.... Get processes list problem (win 2000) Reading an XML file into a Dataset - problem forecolor of button ??? Collection Type BindingManagerBase Problem Hide members in a derived class Good book about VB.NET ? Response.Redirect("WebForm1.aspx") |
|||||||||||||||||||||||