Re: The server connection is refused. Why?
|
Cindrella Schreiber |
|
3/31/2009 11:17:13 PM |
The code: struct sockaddr_in ServerAddress; SOCKET Socket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED); if (INVALID_SOCKET == Socket) { ErrorExit("WSASocket error", WSAGetLastError()); return SOCKET_ERROR; //error } WSAEVENT eevent = WSACreateEvent(); WSAEventSelect(Socket, eevent, FD_CONNECT); ZeroMemory((char *) &ServerAddress, sizeof(ServerAddress)); ServerAddress.sin_family = AF_INET; ServerAddress.sin_addr.S_un.S_addr = ulIp; ServerAddress.sin_port = htons(nPortNo); if (SOCKET_ERROR == WSAConnect(Socket, reinterpret_cast<const struct sockaddr *>(&ServerAddress),sizeof(ServerAddress), NULL, NULL, NULL, NULL)) { int iErrCode = WSAGetLastError(); if(iErrCode != WSAEWOULDBLOCK) { closesocket(Socket); ErrorExit("WSAConnect error", iErrCode); return SOCKET_ERROR; //error } } DWORD retCode = WSAWaitForMultipleEvents(1, &eevent, TRUE, INFINITE, FALSE); WSANETWORKEVENTS NetworkEvents; if((retCode != WSA_WAIT_FAILED) && (retCode != WSA_WAIT_TIMEOUT)) { if(WSAEnumNetworkEvents(Socket, eevent, &NetworkEvents) == SOCKET_ERROR) { int iErrCode = WSAGetLastError(); } if((NetworkEvents.lNetworkEvents & FD_CONNECT ) == FD_CONNECT) { int iErrCode = WSAGetLastError(); if(iErrCode == WSAECONNREFUSED) { ErrorExit("Server refuse!", iErrCode); return SOCKET_ERROR; } } } return Socket; Post Comments |
|
Re: Perhaps it is occurring at the router frame...
|
Dender Afukay |
|
3/31/2009 11:18:21 PM |
Hi Cybdrella, Perhaps it is occurring at the router frame or some other firewall. Have you tested a traceroute? Post Comments |
|
i will try it. its some possibility to fix it? the FD_CONNECT event occurs but WSAECONNREFUSED error not. Post Comments |
|
Re: i cant capture packets
|
Cindrella Schreiber |
|
3/31/2009 11:19:48 PM |
i cant capture packets in wireshark or ethereal because they cant capture localhost packets. i tried to fix it like this http://wiki.wireshark.org/CaptureSetup/Loopback but it didnt fix it Post Comments |
|
Re: The server connection is refused. Why?
|
smith sinhe |
|
8/10/2010 4:38:01 AM |
Hi Web performance did a comparative analysis of Apache Tomcat on linux and Windows. Which showed that under identical conditions. Tomcat can server 32% more users simultaneously on Linux than on MS Widows. __________________________________________________ _____________ Want to get-on Google's First page and loads of traffic to your website? Hire a SEO Specialist from Ocean Group [url=http://oceangroup.org/]seo pecialist [/url] Post Comments |
|
Re: The server connection is refused. Why?
|
smith sinhe |
|
8/10/2010 4:39:00 AM |
Hi Web performance did a comparative analysis of Apache Tomcat on linux and Windows. Which showed that under identical conditions. Tomcat can server 32% more users simultaneously on Linux than on MS Widows. __________________________________________________ _____________ Want to get-on Google's First page and loads of traffic to your website? Hire a SEO Specialist from Ocean Group [url=http://oceangroup.org/]seo pecialist [/url] Post Comments |
|