Hi everyone,
I am running a .Net application on a Windows box, talking to the SB2LE over the network via port 1000, and using it to turn a relay on and off on the GPIO pins.
When I start up, I can connect using a System.Net.Sockets.TcpClient object, and send messages like P07=1 and P07=0 to turn the relay on and off to my heart's content.
After an hour, if I try again, the .net runtime returns this error:
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host
If I attempt to reconnect on port 1000, the command that worked previoulsy throws the following error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.174:1000
If I power the SB2LE down and up again, then I can connect and toggle the pins just fine.
Any suggestions as to what I am doing wrong?
Thanks.
Marc
Newbie on SBL2e: timeout on port 1000?
Re: Newbie on SBL2e: timeout on port 1000?
How about if you try the same experiment using telnet instead of your custom program? That might tell you if the error is in your windows program (eg not closing the socket) or the sbl2e
Re: Newbie on SBL2e: timeout on port 1000?
Dang, that's a good point. I'll give it a try.
Thanks for the quick suggestion, much appreciated.
Marc
Thanks for the quick suggestion, much appreciated.
Marc
Re: Newbie on SBL2e: timeout on port 1000?
And if it turns out it was your .NET program not closing the socket properly, you might want to search this forum or the wiki for posts about "KeepAlive" for one technique for recovering from clients behaving badly.
Re: Newbie on SBL2e: timeout on port 1000?
Hi guys,
Thanks again for your suggestions. Telnet was most helpful in diagnosis.
When the .NET program could not reconnect, I tried telnet, and it failed to connect as well.
When I was ready to call it an SBL2e problem, I launched telnet on another computer on our LAN, and I was able to Telnet into port 1000 just fine, no problems. So I transferred the .NET program to this second computer, and it ran fine for 12 hours, no problem maintaining a connection.
Back to the original computer, it still could not telnet into the SBL2e even after a reboot (though discovery via UDP worked) until I powered the
SBL2e off and on.
So I think tod's suggestion that the .NET program (or Visual Studio) was leaving a socket in a really bad state is a good one. But could it mess up the socket on the SBL2e itself? More diagnoses to run, and Google searching to do.
Thanks again for your helpful advice.
Marc
Thanks again for your suggestions. Telnet was most helpful in diagnosis.
When the .NET program could not reconnect, I tried telnet, and it failed to connect as well.
When I was ready to call it an SBL2e problem, I launched telnet on another computer on our LAN, and I was able to Telnet into port 1000 just fine, no problems. So I transferred the .NET program to this second computer, and it ran fine for 12 hours, no problem maintaining a connection.
Back to the original computer, it still could not telnet into the SBL2e even after a reboot (though discovery via UDP worked) until I powered the
SBL2e off and on.
So I think tod's suggestion that the .NET program (or Visual Studio) was leaving a socket in a really bad state is a good one. But could it mess up the socket on the SBL2e itself? More diagnoses to run, and Google searching to do.
Thanks again for your helpful advice.
Marc