Debugger Causing NetworkStream.Send Hang

I have once again returned to the SCM20260D and its built in ethernet. I stripped my code down to a fairly minimum example and created a desktop app to communicate with the box over TCP/IP using a NetworkStream. The console app sends the box a string-based command every 500 ms. The box parses the command string, then returns a response. Throughout this code, I have timers telling me how long everything is taking. If I have the debugger attached to the box, the system routinely fails in <10 min, usually <5. The timers indicate the system is getting to the NetworkStream.Send() and hanging there. The Console app will then time out the NetworkStream and when the box gets the timeout, it exceptions out of the send. If I run this without the debugger attached, it’ll at least run overnight. It is pretty clear that somehow the debugger is causing the NetworkStream.Send() to hang occasionally. Happy to provide the two projects.

Hi, please send us simple project to look.

Also, please check if this workaround does work for you.

socket send can be failed if send too fast. · Issue #1015 · ghi-electronics/TinyCLR-Libraries (github.com)

Did you send us these two projects yet?

we haven’t seen any one from you, if I remember correctly.

I haven’t sent them yet. What is the easiest way to share these with you? Just email a zip file or what?

You can send to me directly.

many thanks.

Got the files, thanks,

Hi, we just tested your example, and could not reproduce.

From the project you sent to us, I had to disable line 66 and line 69 (Program.cs) to run correctly.

Reason is, as quick look and understand the project, client send “WaitForComplete” message to host and wait for response, but host does not do anything after received this message from client, cause timeout waiting event on client.

We tried few times, each time run more than 10 mins, no crashed found.

Did you try with/without hub, serial port? I just want to find the way to reproduce.

Thanks

Ah yeah, sorry I left those two in there. I added those as I increased the complexity of my test code, but the condition on my setup remains without those two lines. My network topology is the same as it has been for years running with the G400D and I now have a system running the SCM20260D and without the debugger attached, it has been running for over a week with no issues. I will try to narrow this down a bit more on my end. Can you maybe leave it running overnight just to see if it is less frequent on your system? I’ll also disable the timeouts on both ends and see if when it does hang it ever continues after some duration.