Official eMule-Board: How To Create Just One Socket For Serversocket? - Official eMule-Board

Jump to content


Page 1 of 1

How To Create Just One Socket For Serversocket?

#1 User is offline   janequeen 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 55
  • Joined: 24-August 05

Post icon  Posted 10 February 2006 - 03:25 AM

I find that when eMule try to login to a server in the serverlist, it first creates a serversocket. If it cannot login to this server, it will try to login to another server in the serverlist, and it then creates another serversocket. But I wander how to deal with the first serversocket. I want to just create one serversocket for login to a server. Or ,I can say, I want to delete the first serversocket before I create another socket. Is it more reasonable? And how can I do this?
0

#2 User is offline   BlueSonicBoy 

  • Magnificent Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 396
  • Joined: 26-September 04

Posted 10 February 2006 - 08:22 PM

janequeen, on Feb 9 2006, 10:25 PM, said:

I find that when eMule try to login to a server in the serverlist, it first creates a serversocket. If it cannot login to this server, it will try to login to another server in the serverlist, and it then creates another serversocket. But I wander how to deal with the first serversocket. I want to just create one serversocket for login to a server. Or ,I can say, I want to delete the first serversocket before I create another socket. Is it more reasonable? And how can I do this?
View Post



I have only had a quick five minute look at the code so please forgive any mistakes:

So in void CServerSocket::OnConnect(int nErrorCode)

void CServerSocket::OnConnect(int nErrorCode) said:


  case WSAEADDRNOTAVAIL:
  case WSAECONNREFUSED:
  //case WSAENETUNREACH: // let this error default to 'fatal error' as it does not inrease the server's failed count
  case WSAETIMEDOUT: 
  case WSAEADDRINUSE:
  if (thePrefs.GetVerbose())
    DebugLogError(_T("Failed to connect to server %s; %s"), cur_server->GetAddress(), GetFullErrorMessage(nErrorCode));
  m_bIsDeleting = true;
  SetConnectionState(CS_SERVERDEAD);
  serverconnect->DestroySocket(this);
  return;

Note:

Quote

in EMSocket.h

class CEMSocket : public CAsyncSocketEx, public ThrottledFileSocket

in ServerSocket.h

class CServerSocket : public CEMSocket


OnConnect(int nErrorCode) :flowers:
0

#3 User is offline   SlugFiller 

  • The one and only master slug
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 6,988
  • Joined: 15-September 02

Posted 12 February 2006 - 11:02 AM

Well, you can't reuse the socket, since sockets are per-connection, so just to switch to the IP of another server, you have to create a new socket.

As for deleting the old, isn't it done automatically already(provided the the old isn't still attemptint to connect)?

This post has been edited by SlugFiller: 11 March 2006 - 08:41 PM

Why haven't you clicked yet?

SlugFiller rule #1: Unsolicited PMs is the second most efficient method to piss me off.
SlugFiller rule #2: The first most efficient method is unsolicited eMails.
SlugFiller rule #3: If it started in a thread, it should end in the same thread.
SlugFiller rule #4: There is absolutely no reason to perform the same discussion twice in parallel, especially if one side is done via PM.
SlugFiller rule #5: Does it say "Group: Moderators" under my name? No? Then stop telling me about who you want to ban! I really don't care! Go bother a moderator.
SlugFiller rule #6: I can understand English, Hebrew, and a bit of Japanese(standard) and Chinese(mandarin), but if you speak to me in anything but English, do expect to be utterly ignored, at best.
0

#4 User is offline   janequeen 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 55
  • Joined: 24-August 05

Posted 14 February 2006 - 01:46 AM

SlugFiller, on Feb 12 2006, 11:02 AM, said:

Well, you can't reuse the socket, since sockets are pre-connection, so just to switch to the IP of another server, you have to create a new socket.

As for deleting the old, isn't it done automatically already(provided the the old isn't still attemptint to connect)?
View Post

Thank you! I find that eMule always creates a new serversocket before it destroys the old one. I just worried something would be wrong in the interval that two sockets alive.
0

  • Member Options

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users