Code example for DatagramSocket

Methods: getLocalPort

0
     * @return The port number of the open socket on the local host used 
     *         for the connection. 
     ***/ 
    public int getLocalPort() 
    { 
        return _socket_.getLocalPort();
    } 
 
 
    /*** 
     * Returns the local address to which the client's socket is bound. 
     * If you call this method when the client socket is not open, a 
     * NullPointerException is thrown. 
     * <p> 
     * @return The local address to which the client's socket is bound. 
     ***/ 
    public InetAddress getLocalAddress()
    { 
        return _socket_.getLocalAddress();
    }