当前位置: 技术问答>linux和unix
大家看看我的这个程序 急
来源: 互联网 发布时间:2016-09-24
本文导语: #include #include #include #include #include #include #include #include #include int main() { FILE *fp1; int sock,sock_fd; char buf[100]="hello world"; struct sockaddr_in addr; struct hostent *hp; if((sock=socket(AF_INET,SOCK_STREAM,0))==-1) { print...
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
FILE *fp1;
int sock,sock_fd;
char buf[100]="hello world";
struct sockaddr_in addr;
struct hostent *hp;
if((sock=socket(AF_INET,SOCK_STREAM,0))==-1)
{
printf("socket error");
exit(0);
}
hp=gethostbyname("192.168.1.102");
memset(&addr,0,sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_port=htons(13000);
if(inet_pton(AF_INET,"192.168.1.102",&addr.sin_addr.s_addr)
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
FILE *fp1;
int sock,sock_fd;
char buf[100]="hello world";
struct sockaddr_in addr;
struct hostent *hp;
if((sock=socket(AF_INET,SOCK_STREAM,0))==-1)
{
printf("socket error");
exit(0);
}
hp=gethostbyname("192.168.1.102");
memset(&addr,0,sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_port=htons(13000);
if(inet_pton(AF_INET,"192.168.1.102",&addr.sin_addr.s_addr)