Programming - cpueblo.com

accept() - 클라이언트 IP 가져오기(?)


글쓴이 : 유광희 날짜 : 2003-02-14 (금) 15:36 조회 : 7838
SOCKET s;  
SOCKET client_s;  
char lpszMsg[100];  
SOCKADDR_IN m_addr;  
SOCKADDR_IN m_clientAddr;  
client_s = accept(s, (LPSOCKADDR)&m_clientAddr, &m_nClientAddrLen); 
if (client_s == INVALID_SOCKET) { 
        wsprintf(lpszMsg, "accept() 에러 번호: %d", WSAGetLastError()); 
        MessageBox(hwnd, lpszMsg, "에러", MB_OK); 
} else { 
        wsprintf(lpszMsg, "client IP: %s",inet_ntoa(m_clientAddr.sin_addr.s_addr)); MessageBox        (hwnd, lpszMsg, "에러", MB_OK); 

}