블로그는 나의 힘!
[ Programing ]/Server2013. 10. 25. 12:34

socket function

 

unsigned int uiSock = socket( PF_INET, SOCK_STREAM, IPROTO_TCP );

여기서 uiSock에 만약 INVALID_SOCKET 이게 넘어오면 WSAGetLastError로 로그 남기는 버릇도 들일것

 

 

 

unsigned int uiSock = socket( PF_INET, SOCK_STREAM, IPROTO_TCP );

if( INVALID_SOCKET == hSock )

{
     DWORD dwErrorCode = WSAGetLastError();
     printf( " FAIL. InvalidSocket(%d) \n", dwErrorCode );
}

 

...

 

closesocket( uiSock );

 

 

 

 

참조 : msdn.microsoft.com/en-us/library/windows/desktop/ms740506(v=vs.85).aspx

 

Posted by Mister_Q