当前位置: 技术问答>linux和unix
传输文件的程序,只有发送方退出,接受方才能接受到文件,哪里出错了
来源: 互联网 发布时间:2016-04-04
本文导语: 客户端 #include #include #include #include #include #include #include main() { int n,m; char buf[1024],file[30],command[10],str[10]; int fromlen,source; int k,s,ns,target; struct sockaddr_in sin,cliaddr; struct hostent *hp; hp=gethostbyname("F80_test"); if(hp==NU...
客户端
#include
#include
#include
#include
#include
#include
#include
main()
{
int n,m;
char buf[1024],file[30],command[10],str[10];
int fromlen,source;
int k,s,ns,target;
struct sockaddr_in sin,cliaddr;
struct hostent *hp;
hp=gethostbyname("F80_test");
if(hp==NULL)
{
perror(" host address error");
exit(2);
}
s=socket(AF_INET,SOCK_STREAM,0);
if(sh_addr,&sin.sin_addr,hp->h_length);
if(bind(s,&sin,sizeof(sin))
#include
#include
#include
#include
#include
#include
#include
main()
{
int n,m;
char buf[1024],file[30],command[10],str[10];
int fromlen,source;
int k,s,ns,target;
struct sockaddr_in sin,cliaddr;
struct hostent *hp;
hp=gethostbyname("F80_test");
if(hp==NULL)
{
perror(" host address error");
exit(2);
}
s=socket(AF_INET,SOCK_STREAM,0);
if(sh_addr,&sin.sin_addr,hp->h_length);
if(bind(s,&sin,sizeof(sin))