#include <stdio.h>
#include "winsock.h"
int main(int argc, char *argv[])
{
WSADATA ws;
WSAStartup (MAKEWORD( 1, 1 ), &ws);
SOCKET s = socket (AF_INET, SOCK_DGRAM, 0);
sockaddr_in st_addr;
st_addr.sin_family=AF_INET;
st_addr.sin_port=htons(7777 );
st_addr.sin_addr.s_addr=inet_addr("91.201.41.147");
connect (s, (sockaddr *) &st_addr, sizeof (st_addr) );
char sPacket[12];
sPacket[0] = 'S';
sPacket[1] = 'A';
sPacket[2] = 'M';
sPacket[3] = 'P';
sPacket[10] = 'i';
sPacket[11] = 0;
send(s,sPacket,sizeof(sPacket),0);
char buff[1000];
int nbytes = recv(s,&buff[0],sizeof(buff),0);
for (int i = 0; i < nbytes; i++)
{
printf("%c",buff[i]);
}
getchar();
}
|