c# - Socket Connection Error -


i facing wierd socket connection problem in .net windows application.i using socket .net asynchonously communicate legacy intersystems cache database.

i have specific timeout value in application, when timeout occurs, user prompted stay connected application. when stay connected, socket not being reset.
set timeout 30 mins , stay connected first idle time.then when navigate application works fine. if out navigating in application , stay connected second time, , navigate in app getting socket "host refused" connection error. can assume may socket terminated.

wierd part if set application timeout 10 mins, getting socket error second time. when check sockets connected property, still true. not catching exception when call sockets send method. data not passed socket.i have checked other .net code. fine. problem occurs rarely, 1 in 10 times. suggestions helpful.

this sounds typical issue resulting firewalls or other tcp settings.
firewalls might silently disconnect connection if idle more x seconds.
tcp protocol not generate event in such case (similar removing network cable), highly recommended send ping message every x seconds, firewall stays open , can sure connected. if ping missed, server disconnects client.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -