version 1.18, 2005/03/15 15:54:05
|
version 1.19, 2005/03/15 16:35:46
|
|
|
{ | { |
/* peer 0 receives from all other peers */ | /* peer 0 receives from all other peers */ |
struct sock_info peer[NUM_UDP_PEERS]; | struct sock_info peer[NUM_UDP_PEERS]; |
char testdata[16]; |
char buf[16]; |
char recvbuf[16]; |
|
int sl, i; | int sl, i; |
| |
for ( i = NUM_UDP_PEERS - 1; i >= 0; i-- ) { | for ( i = NUM_UDP_PEERS - 1; i >= 0; i-- ) { |
|
|
| |
for ( i = 1; i < NUM_UDP_PEERS; i++ ) { | for ( i = 1; i < NUM_UDP_PEERS; i++ ) { |
/* send client's ip */ | /* send client's ip */ |
strcpy ( testdata, inet_ntoa ( peer[i].addr.sin_addr ) ); |
memcpy( buf, &peer[i].addr.sin_port, sizeof(peer[i].addr.sin_port) ); |
ok ( sendto ( peer[i].s, testdata, sizeof(testdata), 0, (struct sockaddr*) &peer[0].addr, sizeof(peer[0].addr) ) != SOCKET_ERROR, "UDP: socket error on sendto(): %d\n", WSAGetLastError() ); |
ok ( sendto ( peer[i].s, buf, sizeof(buf), 0, (struct sockaddr*) &peer[0].addr, sizeof(peer[0].addr) ) != SOCKET_ERROR, "UDP: socket error on sendto(): %d\n", WSAGetLastError() ); |
} | } |
| |
for ( i = 1; i < NUM_UDP_PEERS; i++ ) { | for ( i = 1; i < NUM_UDP_PEERS; i++ ) { |
ok ( recvfrom ( peer[0].s, recvbuf, sizeof(recvbuf), 0,(struct sockaddr *) &peer[0].peer, &sl ) != SOCKET_ERROR, "UDP: socket error on recvfrom(): %d\n", WSAGetLastError() ); |
ok ( recvfrom ( peer[0].s, buf, sizeof(buf), 0,(struct sockaddr *) &peer[0].peer, &sl ) != SOCKET_ERROR, "UDP: socket error on recvfrom(): %d\n", WSAGetLastError() ); |
ok ( ! strcmp ( inet_ntoa ( peer[0].peer.sin_addr), recvbuf ), "UDP: port numbers do not match\n" ); |
ok ( memcmp ( &peer[0].peer.sin_port, buf, sizeof(peer[0].addr.sin_port) ) == 0, "UDP: port numbers do not match\n" ); |
} | } |
} | } |
| |
|
|
| |
/* first time through, should resize buffer */ | /* first time through, should resize buffer */ |
pserv1 = getservbyname ( "telnet", "tcp" ); | pserv1 = getservbyname ( "telnet", "tcp" ); |
pserv2 = getservbyname ( "kerberos" , "udp" ); |
pserv2 = getservbyname ( "chargen" , "udp" ); |
|
|
ok ( pserv1 != pserv2, "getservbyname: winsock did not reallocate servent buffer\n" ); | ok ( pserv1 != pserv2, "getservbyname: winsock did not reallocate servent buffer\n" ); |
| |
for ( i = 0; i < NUM_QUERIES / 2; i++ ) { | for ( i = 0; i < NUM_QUERIES / 2; i++ ) { |