* @throws Exception
*/
public UdpConnection( String uri, Resources resources )
throws Exception
{
URL u = new URL( uri );
listen = u.getBooleanTerm( "listen", false );
host = translateHost( u.getHost() );
if (!listen && host == null)
throw new IllegalArgumentException( "host == null" );
port = u.getPort();
if (port == null)
throw new IllegalArgumentException( "port == null" );
if (port <= 0 || port > 65535)
throw new IllegalArgumentException( "port <= 0 || port > 65535" );
setDefaultTrafficClass( u.getIntegerTerm( TRAFFIC_CLASS, 0 ) );
// there are three ways to do this:
// 1. bound socket, unconnected (listening to anyone on well-known host/port
// 2. bound socket, connected (listening to someone on well-known host/port)
// 3. unbound socket, connected (listening to someone on assigned host/port)