Home > Back-end >  The fox login server and coordination server connection problem
The fox login server and coordination server connection problem

Time:09-24



Connect to coordinate server after a few seconds automatically disconnect and coordination server? For half a day all don't know where the problem is, the great god know the fox network 6603 source code, please help me find the source, because of my source code from the Internet looking for don't know whether the kernel engine problem or what?
Solving!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

No one to help me solve the problem

CodePudding user response:

//to establish a SOCKET
M_hSocket=socket (AF_INET SOCK_STREAM, IPPROTO_TCP);
If (m_hSocket==INVALID_SOCKET) throw TEXT (" SOCKET creation failed ");

//efficacy parameter
ASSERT (m_hSocket!=INVALID_SOCKET);
ASSERT (m_cbSocketStatus==SOCKET_STATUS_IDLE);
//m_cbSocketStatus=SOCKET_STATUS_IDLE;
If (m_hWnd==NULL) Create, NULL, NULL, WS_CHILD, CRect (0, 0, 0, 0), GetDesktopWindow (), ID_SOCKET_WND, NULL);
If (m_hWnd==NULL) throw TEXT (" create Windows internal error ");
Int iErrorCode=WSAAsyncSelect (m_hSocket, m_hWnd, WM_SOCKET_NOTIFY FD_CONNECT | FD_READ | FD_CLOSE);
If (iErrorCode==SOCKET_ERROR) throw TEXT (" binding internal window error ");

//the server address
SOCKADDR_IN Addr.
Memset (& amp; Addr, 0, sizeof (Addr));
Addr. Sin_family=AF_INET;
Addr. Sin_port=htons (m_wPort);
Addr. Sin_addr. S_un. S_addr=htonl (m_dwServerIP);
IErrorCode=connect (m_hSocket, (sockaddr *) & amp; Addr, sizeof (SOCKADDR_IN));
If (SOCKET_ERROR==iErrorCode)
{
IErrorCode=WSAGetLastError ();
Throw the TEXT (" when the notification callback connection SOCKET failed ");
}
}
The catch (LPCTSTR pszError)
{
CTraceService: : TraceString (pszError TraceLevel_Exception);
}

CodePudding user response:

Whether WSAAsyncSelect can only be used for the server, see online are only used for the server connection
Connect in the client side by return SOCKET_ERROR don't understand this so to solve the great god!!!!!!!!!!

And board games like this with what kind of way to design the server better such as the completion port model??
This download the kernel CTCPSocketService classes have been changed beyond recognition now can I communication,

But I want to follow WSAAsyncSelect the party is trying to communicate

Does anyone know the client WSAAsyncSelect communications,

CodePudding user response:

The coordination service didn't write the address, if you are a local test, it changed the address to 127.0.0.1 namely ServerParaeter. Ini file

CodePudding user response:

Is not the problem, how many have online source of the problem, is the kernel of the socket has a problem, now change good

CodePudding user response:

LZ, you will let us know to modify what place, please, I can't find what the reason, looking for a long time

CodePudding user response:

Hello, your problem solved, we encountered the same problem

CodePudding user response:

Meet the same problem where is the original poster can provide a specific question? Thank you
  • Related