#include <stdio.h>
#include <winsock.h>
#pragma comment(lib,"Ws2_32")
#define MAXSIZE 100
main(int argc,char *argv[])
{
int bytenum=0,
char buf[MAXSIZE];
SOCKET socket_fd;
struct sockaddr_in their_addr;
WSADATA ws;
WSAStartup(MAKEWORD(2,2),&ws);
socket_fd=socket(AF_INET,SOCK_STREAM,0);
their_addr.sin_family=AF_INET;
their_addr.sin_port=htons(830);
their_addr.sin_addr.s_addr=inet_addr(argv[1]);
bind(socket_fd,(struct sockaddr *)&their_addr,sizeof(struct sockaddr));
connect(socket_fd,(struct sockaddr *)&their_addr,sizeof(struct sockaddr));
printf("connecting.....");
bytenum=recv(socket_fd,buf,MAXSIZE,0);
buf[bytenum]='\0';
printf("receive %s",buf);
closesocket(socket_fd);
return 0;
}
FFIVE
慕村9548890
相关分类