{
SendSocket=socket (AF_INET SOCK_STREAM, 0).
SockStruct. Sin_family=AF_INET;//using TCP/IP protocol
SockStruct. Sin_port=htons (8080);
SockStruct. Sin_addr. S_un. S_addr=inet_addr (" 10.253.176.14 ");
If (connect (SendSocket, (LPSOCKADDR) & amp; SockStruct, sizeof (sockStruct))==SOCKET_ERROR)
{
Unable to connect to the server AfxMessageBox (" ");
return false;
}
IsLink=TRUE;
WSAAsyncSelect (SendSocket m_hWnd, WM_CLIENT_READCOLOSE, FD_READ | FD_CLOSE);
return true;
}
Every time call connection function connection always returns "unable to connect to the server," what is going on ahhh
CodePudding user response:
What is call WSAGetLastError, you see an error code, or try the socket example here:http://download.csdn.net/detail/geoff08zhang/4571358
CodePudding user response:
Before use, no load socket character?