Using netstat - an see listen port
Run to the __ACCPETEX throw WSA_IO_PENDING repeatedly using the accept can query to the listening port
Void * m_szTSock=NULL;
__sock_Create (& amp; M_szTSock, TSOCK_USER_MODETCP | TSOCK_USER_IOCP | TSOCK_USER_SERVICE | TSOCK_USER_OVERAPPED, 65535, 10, (40 * 1024 * 1024), a 0, NULL, 1111);
DWORD WINAPI __sock_WorkThread (PVOID m_lpPoint) {
If (m_lpPoint==NULL) return 1;
P__TSOCK m_szSocket=(P__TSOCK m_lpPoint);
If (m_szSocket - & gt; Initover==0) return - 2;
DWORD m_szTNumber=0; ULONG_PTR m_lpUKey=0; LPOVERLAPPED m_szOLapped=NULL; BOOL m_szRCode=0;
While (m_szSocket - & gt; The exit==0) {
M_szRCode=GetQueuedCompletionStatus (m_szSocket - & gt; Iocomple, & amp; M_szTNumber, & amp; M_lpUKey, & amp; M_szOLapped, INFINITE);
Sleep (10);
}
return 0;
}
DWORD WINAPI __sock_Accpet (PVOID m_lpPoint) {
If (m_lpPoint==NULL) return 1;
P__TSOCK m_szSocket=(P__TSOCK m_lpPoint); P__MEMNODE m_szMemNode=NULL; BOOL m_szRBool=FALSE;
If (m_szSocket - & gt; Initover==0) return - 2;
If (m_szSocket - & gt; __AcceptEx==NULL) return - 3;
If ((m_szSocket - & gt; Optype & amp; TSOCK_USER_SERVICE)==0) return - 4;
LPPER_IO_DATA m_lpOutBuff=NULL; Unsigned long m_szRWLen=0; Unsigned long m_szInClient=0; Char m_szFaidNum=0;
While (m_szSocket - & gt; The exit==0) {
M_szMemNode=NULL; M_lpOutBuff=NULL;
If (m_szSocket - & gt; Umembuff==0) {m_lpOutBuff=(LPPER_IO_DATA) malloc (sizeof (PER_IO_DATA)); If (m_lpOutBuff==NULL) {break; }; }
The else {the if (__mem_Write (m_szSocket - & gt; Mempoint, "0", sizeof (PER_IO_DATA), & amp; M_szRWLen, & amp; M_szMemNode)!=1) {break; } m_lpOutBuff=(LPPER_IO_DATA) (((unsigned char *) m_szMemNode) + sizeof (__MEMNODE)); }
: : memset (m_lpOutBuff, 0, sizeof (PER_IO_DATA));
M_lpOutBuff - & gt; DateLen=sizeof (m_lpOutBuff - & gt; DataBuff); M_lpOutBuff - & gt; OpType=1;
If (m_szSocket - & gt; Smode==1) {m_lpOutBuff - & gt; The client=WSASocket (IPPROTO_TCP AF_INET, SOCK_STREAM, 0, 0, m_szSocket - & gt; Eiocp); }
The else {m_lpOutBuff - & gt; The client=WSASocket (AF_INET, SOCK_DGRAM IPPROTO_UDP, 0, 0, m_szSocket - & gt; Eiocp); }
If (m_lpOutBuff - & gt; The client==INVALID_SOCKET) break;
NEXTINCLIENT: NULL;
M_szRBool=m_szSocket - & gt; __AcceptEx (m_szSocket - & gt; Hsocket m_lpOutBuff - & gt; Client, m_lpOutBuff - & gt; DataBuff m_lpOutBuff - & gt; DateLen - ((sizeof (sockaddr_in) + 16) * 2), sizeof (sockaddr_in) + 16, sizeof (sockaddr_in) + 16, & amp; M_lpOutBuff - & gt; ArLen, & amp; (m_lpOutBuff - & gt; OverLapped));
If (WSA_IO_PENDING==WSAGetLastError () & amp; & M_szFaidNum==0) {+ + m_szFaidNum; Sleep (0); Goto NEXTINCLIENT; }
If (m_szRBool==FALSE) {
{if (m_szFaidNum==0) break; }
M_lpOutBuff - & gt; IClientLen=sizeof (m_lpOutBuff - & gt; IClient);
M_lpOutBuff - & gt; The client=: : accept (m_szSocket - & gt; Hsocket, & amp; M_lpOutBuff - & gt; IClient, & amp; M_lpOutBuff - & gt; IClientLen);
//m_lpOutBuff - & gt; The client=: : accept (m_szSocket - & gt; Hsocket, NULL, NULL);
If (m_lpOutBuff - & gt; The client==SOCKET_ERROR | | m_lpOutBuff - & gt; The client==INVALID_SOCKET) {break; }
M_lpOutBuff - & gt; IfClient=1;
}
If (m_szSocket - & gt; Eiocp==1) {if (: : CreateIoCompletionPort ((HANDLE) m_lpOutBuff - & gt; Client, m_szSocket - & gt; Iocomple, (ULONG_PTR) & amp; M_lpOutBuff, 0)==NULL) {break; }}
If (m_szInClient & gt;=m_szSocket - & gt; McOnnect) {Sleep (0); Goto NEXTINCLIENT; }
+ + m_szInClient;
}
Int m_szGCode=: : GetLastError ();
Int m_szSCode=: : WSAGetLastError ();
If (m_lpOutBuff!=NULL) {if (m_szSocket - & gt; Umembuff==0) {free (m_lpOutBuff); M_lpOutBuff=NULL; } else {__mem_Free (m_szSocket - & gt; Mempoint); }}
Return: : WSAGetLastError ();
}
Char __sock_Create (void * * i_lpToint, unsigned char i_szType, unsigned long m_szMConnect, unsigned long i_szMListen, unsigned long i_szMSize, unsigned long i_szTNumber, char * i_lpIp, unsigned short i_szPort) {
If (i_lpToint==NULL) return 1;
P__TSOCK m_szSocket=(* i_lpToint P__TSOCK); Char m_szIsCreate=0; Char m_szECode=0;
If (* i_lpToint==NULL) {m_szSocket=(P__TSOCK) malloc (sizeof (__TSOCK)); If (m_szSocket==NULL) {return - 2; } m_szIsCreate=1; }
: : memset (m_szSocket, 0, sizeof (__TSOCK));
If (i_szMSize!=0 & amp; & (i_szType & amp; TSOCK_USER_SERVICE)!=0) {
If (__mem_Create (i_szMSize 0, 0, & amp; M_szSocket - & gt; Mempoint)! (=1) {if m_szIsCreate==1) {free (m_szSocket); } the return - 3; }
M_szSocket - & gt; Memsize=i_szMSize; M_szSocket - & gt; Umembuff=1;
}
M_szSocket - & gt; Systnumber=i_szTNumber; M_szSocket - & gt; McOnnect=m_szMConnect; If (m_szSocket - & gt; McOnnect==0) {m_szSocket - & gt; McOnnect=0 xfffffffe; }
If (i_szTNumber==0) {SYSTEM_INFO si; GetSystemInfo (& amp; Si); M_szSocket - & gt; Systnumber=si. DwNumberOfProcessors * 2; }
If ((i_szType & amp; TSOCK_USER_MODETCP)!=0) {m_szSocket - & gt; Smode=1; }
//(();
If ((i_szType & amp; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull