I believe the API should be asynchronous here.  I'm not confortable with either waiting for a short timeout period or setting the socket to non-blocking mode.  In either case you may end up getting an exception for the wrong notification.  IMHO the appropriate solution would be to have a separate thread/process read from the socket (in blocking mode, if necessary forever) and execute a callback function.