version 1.20, 2005/03/15 23:14:15
|
version 1.21, 2005/03/15 23:17:36
|
|
|
/* This function tests UDP sendto() and recvfrom(). UDP is unreliable, so it is | /* This function tests UDP sendto() and recvfrom(). UDP is unreliable, so it is |
possible that this test fails due to dropped packets. */ | possible that this test fails due to dropped packets. */ |
| |
/* peer 0 receives from all other peers */ |
/* peer 0 receives data from all other peers */ |
struct sock_info peer[NUM_UDP_PEERS]; | struct sock_info peer[NUM_UDP_PEERS]; |
char buf[16]; | char buf[16]; |
int ss, i, n_recv, n_sent; | int ss, i, n_recv, n_sent; |
|
|
peer[i].addr.sin_addr.s_addr = inet_addr ( SERVERIP ); | peer[i].addr.sin_addr.s_addr = inet_addr ( SERVERIP ); |
| |
if ( i == 0 ) { | if ( i == 0 ) { |
peer[i].addr.sin_port = htons ( SERVERPORT + i ); |
peer[i].addr.sin_port = htons ( SERVERPORT ); |
} else { | } else { |
peer[i].addr.sin_port = htons ( 0 ); | peer[i].addr.sin_port = htons ( 0 ); |
} | } |