본문 바로가기
반응형

분류 전체보기798

간단한 계산을 하는 서버 / 클라이언트 //CalServer.h #pragma pack( 1 ) enum { PLUS = '+', MINUS = '-', MULTIPLY = '*', DIVIDE = '/' } ; typedef struct _CALCPACKET { int cmd; int first; int second; }CALCPACKET; #define WIN32_LEAN_AND_MEAN // windows.h 에서 자주 사용하지 않는 것은 컴파일에서 제외한다. // winsock2.h 와의 충돌을 막아준다. #include #include #include #include #pragma comment(lib, "ws2_32.lib") #include "CalServer.h" void main(int argc, char** argv) { i.. 2007. 1. 22.
웹브라우저에 패킷을 보내기 #define WIN32_LEAN_AND_MEAN // windows.h 에서 자주 사용하지 않은 것은 컴파일에서 제외 한다. // winsock2.h외의 충돌을 막아 준다. #include #include #include #pragma comment(lib, "ws2_32.lib") void main() { WSADATA wsadata; //if(WSAStartup(0x0202, &wsadata) != 0)//0x0202는 뒤에서부터 읽어서 2.2버젼을 쓰라는 이야기다. if(WSAStartup(MAKEWORD(2,2), &wsadata) != 0)//많이 사용... 앞에서 부터 읽는다. { printf("Can't Initialize Socket !\n"); return ; } //----------.. 2007. 1. 22.
네트워크 server와 client //server#define WIN32_LEAN_AND_MEAN // windows.h 에서 자주 사용하지 않은 것은 컴파일에서 제외 한다. // winsock2.h외의 충돌을 막아 준다. #include #include #include #pragma comment(lib, "ws2_32.lib") void main() { WSADATA wsadata; //if(WSAStartup(0x0202, &wsadata) != 0)//0x0202는 뒤에서부터 읽어서 2.2버젼을 쓰라는 이야기다. if(WSAStartup(MAKEWORD(2,2), &wsadata) != 0)//많이 사용... 앞에서 부터 읽는다. { printf("Can't Initialize Socket !\n"); return ; } //--.. 2007. 1. 22.
CString -> char * CString -> char * CString spi = _T("123"); char temp[100]; WideCharToMultiByte(CP_ACP, 0, spi.GetBuffer(spi.GetLength()) , spi.GetLength(), temp, spi.GetLength(), NULL, NULL); i_spi = atoi(temp); char * --> CString char ss[] = "Hello"; CString str; str.Format("%s", ss); (Format대신에 GetBuffer()를 써도 됩니다.) 2007. 1. 22.
반응형