1
| | void update( void )
{
sockset.fd_count = 1;
int i = 0;
while( select( 0, &sockset, NULL, NULL, &interval ) > 0 )
{
if( recvfrom( sock, (char *)&tempPlayer, packetSize, 0, (struct sockaddr *)&servAddr, &addrSize ) == packetSize )
{
if( tempPlayer.id == -1 )
Me.id = tempPlayer.loc[0];
else
memcpy( &players[tempPlayer.id].loc, &tempPlayer.loc, locSize );
}
if( i > numPlayers ) break;
sockset.fd_count = 1;
}
} |