clientaddr.sin_family=0; clientaddr.sin_len=sizeof(clientaddr);; clientaddr.sin_addr.s_addr =htonl(0xC0A80BF0); //ARM地址 clientaddr.sin_port = htons(1032);
Netbufc = netbuf_new(); s=socket( 0, SOCK_DGRAM, NETCONN_UDP); bind( s, (struct sockaddr *)&clientaddr,sizeof(struct sockaddr));
while(TRUE) { Len = recvfrom( s, &rec_buffer[0], 150, 0,(struct sockaddr *)&servaddr, &Len1 );
if(Len > 0) { sendto(s, "12345", Len, 0, (struct sockaddr *)&servaddr, sizeof( struct sockaddr) );
} }
为什么时能接收不能发送? |