DatagramSocket.DatagramSocket

DatagramSocket.DatagramSocket

Class Overview | Class Members | This Package | All Packages

Syntax 1
public DatagramSocket() throws SocketException
Description
Constructs a datagram socket and binds it to any available port on the local host machine.

Exceptions
SocketException if the socket could not be opened, or the socket could not bind to the specified local port.



Syntax 2
public DatagramSocket( int port ) throws SocketException
Parameters
local
port to use.
Description
Constructs a datagram socket and binds it to the specified port on the local host machine.

Exceptions
SocketException if the socket could not be opened, or the socket could not bind to the specified local port.



Syntax 3
public DatagramSocket( int port, InetAddress laddr ) throws SocketException
Parameters
port
local port to use
laddr
local address to bind
Description
Creates a datagram socket, bound to the specified local address. The local port must be between 0 and 65535 inclusive.