473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What happens to debugger here?

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
Nov 21 '05 #1
4 1124
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

Nov 21 '05 #2
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
"Adam Goossens" <ad***********@gmail.com> wrote in message
news:%2****************@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

Nov 21 '05 #3
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

Nov 21 '05 #4
Hi Brett,

How do I debug two applications at the same time? Two instances of VS.NET?

Spot on. Run your server in one instance, your client in another, set
some breakpoints and let them go.

Has this problem always occurred, or is it a recent thing?

Regards,
-Adam.
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low...
9
by: zerro | last post by:
Hello, I try to understand heap overflows (under Linux), but can not understand one thing with freeing memory allocated with malloc(). Here it comes: I have a program called 1.c: main() {...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
2
by: Terry Olsen | last post by:
While running my application, either in or out of the debugger, after a while the message box pops up that says "MyApp.vshost.exe has encountered a problem and needs to close." What does the...
3
by: Doug | last post by:
I'm having problems w/ the VS2005 debugger with C#. It blows past any breakpoints in even the simplest "Hello World" console application. I can't do any step-by-step debugging. I've provided the...
4
by: codergem | last post by:
Helo friends Could any of you please help me out with this problem. To me this program of heap sort seems logically perfect but still the output of this is not coming right, I dont want to follow...
9
by: xiao | last post by:
It always dumped when I tried to run it... But it compiles OK. What I want to do is to do a test: Read information from a .dat file and then write it to another file. The original DAT file is...
69
by: Yee.Chuang | last post by:
When I began to learn C, My teacher told me that pointer is the most difficult part of C, it makes me afraid of it. After finishing C program class, I found that all the code I wrote in C contains...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.