221,6 → 221,7 |
fprintf( stderr, "Receive size too small (%d). Using 1024 bytes instead.\n", size ); |
size = 1024; |
} |
// size plus terminating null (\0) |
data = ( char * ) malloc( size + 1 ); |
if( ! data ){ |
fprintf( stderr, "Failed to allocate receive buffer.\n" ); |
284,7 → 285,7 |
fprintf( stderr, "Received address error %d\n", ERROR_CODE ); |
}else{ |
data[ length ] = '\0'; |
printf( "Received from %s:%d\n%s\n", address_string, port, data ); |
printf( "Received %d bytes from %s:%d\n%s\n", length, address_string, port, data ); |
} |
} |
} |