Jump to content
Returning Members: Password Reset Required ×

Recommended Posts

Posted (edited)

Does anyone else ever get `System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.` on Comet 5065. It seems to occur around here (game/MsgConnect):

            if (Kernel.Clients.TryRemove(auth.AccountID, out Client observer))
            {
                Console.WriteLine(auth.AccountID);
                Console.WriteLine(observer);

                observer.Socket.Disconnect(false);
            }

When the error occurs, you can close the client and attempt to reconnect and it will work on that second time connecting but it will prevent at least one connection attempt prior to that.
Happy to try and fix this myself but just wanted to verify that it occurs for others too before I look into a code fix rather than questioning whether it's something in my environment or client that's causing it.

Edited by Zedaf
Posted

Hm, well - the comment that should sit above that code block should explain what it does. If a client is already connected for a given account id, then the other client should be disconnected. Have you modified the disconnect logic in any way and are you trying to connect with an account that's already logged in? The disconnect should clean up those dictionaries and remove the disconnecting client. On the topic of the error itself, you can filter it out in the socket system if you chose it's not helpful. 

Posted (edited)

I noticed on Dragon or Canyon, can't remember where exactly, that Felipe had committed some kind of "fix for ai socket" or something like that, can't find it now, but it touched this function. I noticed that if I changed the value to true (allow reuse of socket) then it also got it working but I haven't really probed deeper into what the ramifications of that are exactly. I'll look into it further tomorrow (later today) and make sure that I didn't alter the disconnect logic in some way.

Edited by Zedaf
Posted
18 hours ago, Zedaf said:

Does anyone else ever get `System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.` on Comet 5065. It seems to occur around here (game/MsgConnect):

            if (Kernel.Clients.TryRemove(auth.AccountID, out Client observer))
            {
                Console.WriteLine(auth.AccountID);
                Console.WriteLine(observer);

                observer.Socket.Disconnect(false);
            }

When the error occurs, you can close the client and attempt to reconnect and it will work on that second time connecting but it will prevent at least one connection attempt prior to that.
Happy to try and fix this myself but just wanted to verify that it occurs for others too before I look into a code fix rather than questioning whether it's something in my environment or client that's causing it.

Make sure ure not adding the Client to the dictionary before this.

if (Kernel.Clients.TryRemove(auth.AccountID, out Client observer))
            {
                observer.Socket.Disconnect(false);
            }

            Kernel.Clients.TryAdd(auth.AccountID, client);

Looking into the 5065 comet code, I didnt download it but it seems to be correct. Just make sure ure not doing the add action before 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...