Code example for DatagramSocket

Methods: connect, setSoTimeout

0
     * @param addr 
     * @return connected Transport 
     * @throws IOException  
     */ 
    public static Transport UDPInstance(SocketAddress addr) throws IOException {
        DatagramSocket sock = new DatagramSocket();
        sock.setSoTimeout(getTimeout());
        sock.connect(addr);
 
        StreamTransport trans = new StreamTransport();
        trans.setStreams(new UDPInputStream(sock), new UDPOutputStream(sock));
        trans.setAddressLabel(addr.toString());
        return trans;
    } 
}