in reply to Buffering with UDP
You question isn't very clear. If you want to check if you can read some data from the socket you can use select or IO::Select.