Xelestial

hi!

i have a problem with my program... I am using Sockets to communicate with another software and it gives me the error "an established connection was aborted by the software in your host machine" then after that the program will terminate. Before i altered my code it does not give this error. I just added a statement in my try-catch if ever the network/ electricity flactuates or goes down. Here is what i added :

catch (Exception ex)

{

string a = ex.Message;

if (a == "ExecuteReader requires an open and available Connection. The connection's current state is closed.")

{

MessageBox.Show("Disconnected from Server1. The application will restart.");

Application.Restart();

}

}



Re: Visual C# General catch statement problem

Jeroen Vos

My guess is that the Application.Restart() causes the problem. This might forcefully close the connection with the 3rd party application and your own, then the 3rd party application will throw the error. As to why your application hits the Exception catch statement in the first place i don't know, it might have been doing that all the time but somehow the exception was caught and suppressed or something.





Re: Visual C# General catch statement problem

Xelestial

i added the code in the catch statement because whenever the network to server1 gets cut my program will stop which is correct but the problem is when they connect it again to the other program it will not work. the solution is they will close my application then restart it and all goes well again.




Re: Visual C# General catch statement problem

Peter Ritchie

Application.Restart only works with WinForms application. Is your appplication a WinFormas application






Re: Visual C# General catch statement problem

Xelestial

yes it is a winform application.




Re: Visual C# General catch statement problem

Citizen on the earth

Hello Xelestial,

From your description, I get to know that you got an exception saying "An established connection was aborted by the software in your host machine" in using sockets to communicate with another application. According to my work experince, there are a couple of cases we know of which can cause them as follows:

1. If this error is being reported by your email client or by VPOP3 when downloading and/or sending email, it could be a problem with your antivirus software. Both McAfee VirusScan 8 and Norton Antivirus 2004 have been found to give these errors sometimes, but other virus scanners or versions may also cause these errors. See below for more information.

2.If the 10053 error is reported in the VPOP3 Status Monitor program, then this usually means that the VPOP3 server has stopped for some reason. It may be that it was stopped by someone else, or it may have failed with an application error.

3.The TCP/IP Connection was aborted by Windows. This was possibly due to a data transmission timeout or protocol error. The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable.

What I want to suggest you to do is to try to check if you have these issues in your application. If you have any questions when trying my suggestions, please let me know. Thanks.

Citizens on the earth