Ok... as you can see from the title of my post, I am pretty much desperate at this point... so I will regale you with the history of my project, and my problem... take a sit, this will take a while, if you like coffee, go make some... and if you don’t feel like reading through, skip to the end, when I summarize the whole thing.

1 - I was asked by boss to make a "simple" chat application for one of our sites. so far so good, but, as an adobe flash (former macromedia) programmer, I was thinking to use the media server for this (if you don't know what it is 'cos you're not a flash programmer, don't worry, I didn't use it...), but my boss didn't want to use that solution, for this or that reason, so I suggested we use the flash as the client for the chat (as we intended to do any way), and use VB6, with a Winsock component, as the server for the application. My boss liked the idea, and of course he set me to program the client side (no problem) and the server side (a bit of a problem), and since my experience with VB6 is somewhat limited, I set to researching the matter, which started this whole episode.

2 - Some time later, I had me a working client side, made up in flash, nice graphics and all, and a server side exe application, which opened up a stack of sockets (on demand), to which the clients connected and chatted happily ever after, but....

3 - Since the server application was running on our server, and since our server, or at least this specific one (windows server 2003), is located in a server farm somewhere in the Italian wilderness, the way to do anything on the server is via remote terminal, meaning that my server application could not be run in the background, since every time the session of the remote terminal ended, it also killed the app running on the desktop... so of course I used some magic (and some NT files) to set up my application as an NT service, and like the magic that it is, all worked fine, my boss was happy, I was happy, our client was happy, and the users of the site were very happy for the new platform they have received to moan and drone about the little heart aches in their lives and so on.

4 - Alas, this could not have prevailed... it would seem that every so often, I get an error, which my error handler simple can not handle… trying to figure out why this error occurs, find a way around it, under it, above it or on the side, or simply shutting down and restarting my application, when this error occurs, has completely taken my time since it’s started about 2 weeks ago… and that vicious error is the “10054” error, or as I like to call it, the “The connection is reset by remote side” error from HELL!!

5 – The reason I am writing this as a story, and not as a technical question is because I have found many “answers” to this problem, but none of them seemed to work in this case, and… I will get technical in a minute or so. So I opened Google, and googled that error, number, and message, and the best I could come up with is an article by Microsoft, here – http://support.microsoft.com/kb/260018/en-us.

6 – Now… my problem with this article by trusty old Microsoft, is that they are saying there that this error on the Winsock occurs on windows server 2000 machines (ours is 2003), and that it happens when you use a protocol type “sckUDPProtocol”, and I use “sckTCPProtocol”, and more over, that it happens in the data arrival procedure, and that it can not be “captured” by your normal error handling, where in my case, it is being reported in the “Socket_error” procedure, and what more… just before this causes my application to completely crash, I can still take some action, like actually writing a few lines into my log files, logging the error, logging some more information, I still have time (even if it’s a few milisecs) to unload the “bad” socket, redim my arrays, log some stuff for me to sort through, and only then, crash, boom, bang, the application crashes, leaving me only a “application has encountered a problem and had to close” message we all like to see when we log on to our server…

To conclude, we had this working for us:

1 chat client side, made in flash, using built in xml socket component. Working.
1 server side application, made in VB6, using a stack of Winsock with the “sckTCPProtocol” protocol set to them. Working well, until…
1 error, number 10054, description “The connection is reset by remote side” , occurring every once in a while (varies between 15 minutes to 3 days), causing the application to crash, but it would seem that only a few milliseconds after the error is raised, since after the error is raised I am still able to unload the socked that generated that error, redim some arrays, log some stuff to a txt file.

Did any one had this problem before? Can some one tell me what could be the reason for this error, and how can get around it? When I tried to unload my application, then reopen it, and reset the variables in my project, when this specific error occurs, it actually did all that, unloaded my form, reloaded it with .show, and re initialize it (and I know this since I log these events), but still, after all that happens, my application still crashed uncontrollably.

Thanks for listening to all this, but I am really just about to jump off our roof with this problem.


Yuval Lahav.