当前位置: 技术问答>linux和unix
为何udp的sendto返回永远为零????
来源: 互联网 发布时间:2015-04-03
本文导语: #include #include #include #include #include #include #include #include #include #define MAX_BUF_SIZE 1024 void udpc_requ(int sockfd,const struct sockaddr_in *addr,int len); int main(int argc,char *argv[]) { int sockfd; struct sockaddr_in addr; if(argc!=3){ fprintf(...
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MAX_BUF_SIZE 1024
void udpc_requ(int sockfd,const struct sockaddr_in *addr,int len);
int main(int argc,char *argv[])
{
int sockfd;
struct sockaddr_in addr;
if(argc!=3){
fprintf(stderr,"usage:client ipaddr portn");
exit(1);
}
sockfd=socket(AF_INET,SOCK_DGRAM,0);
if(sockfd
#include
#include
#include
#include
#include
#include
#include
#include
#define MAX_BUF_SIZE 1024
void udpc_requ(int sockfd,const struct sockaddr_in *addr,int len);
int main(int argc,char *argv[])
{
int sockfd;
struct sockaddr_in addr;
if(argc!=3){
fprintf(stderr,"usage:client ipaddr portn");
exit(1);
}
sockfd=socket(AF_INET,SOCK_DGRAM,0);
if(sockfd