1 n Format Message DWORD Format Message DWORD Slides: 17 Download presentation 오류 코드를 문자열로 바꾸기 (1) n Format. Message() 함수 DWORD Format. Message ( DWORD dw. Flags, // 옵션 LPCVOID lp. Source, // NULL DWORD dw. Message. Id, // 오류 코드 DWORD dw. Language. Id, // 언어 LPTSTR lp. Buffer, // 오류 문자열 시작 주소 DWORD n. Size, // 0 va_list* Arguments // NULL ); 성공: 오류 메시지의 길이, 실패: 0 TCP/IP 윈도우 소켓 프로그래밍 4 오류 코드를 문자열로 바꾸기 (2) n err_quit() 함수 정의 void err_quit(char *msg) { LPVOID lp. Msg. Buf; Format. Message( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGet. Last. Error(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lp. Msg. Buf, 0, NULL); Message. Box(NULL, (LPCTSTR)lp. Msg. Buf, msg, MB_ICONERRO Local. Free(lp. Msg. Buf); exit(1); } TCP/IP 윈도우 소켓 프로그래밍 5 오류 코드를 문자열로 바꾸기 (4) n err_display() 함수 정의 void err_display(char *msg) { LPVOID lp. Msg. Buf; Format. Message( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGet. Last. Error(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lp. Msg. Buf, 0, NULL); printf("[%s] %s", msg, (char *)lp. Msg. Buf); Local. Free(lp. Msg. Buf); } TCP/IP 윈도우 소켓 프로그래밍 7 소켓 생성과 닫기 (3) n 주소 체계. . . #define AF_INET 2 // Internetwork: UDP, TCP, etc. . #define AF_INET 6 23 // Internetwork Version 6 . . . #define AF_IRDA 26 // Ir. DA . . . #define AF_BTH 32 // Bluetooth RFCOMM/L 2 CAP protocols . . . TCP/IP 윈도우 소켓 프로그래밍 13 Thank you TCP/IP 윈도우 소켓 프로그래밍 www. hanb. co. kr 17