java.net.DatagramSocket (class)
Constructors:
DatagramSocket();
DatagramSocket(int port);
DatagramSocket(int port, InetAddress bindAddr);
General Description: This is the general datagram (UDP) socket for message passing.
Parent Class: Object
Methods
void close(); Close the socket.
void connect(InetAddress addr, int port); Connect peers for implicit sending.
void disconnect(); Disconnect connected peers.
InetAddress getInetAddress(); Get the host address of the peer.
InetAddress getLocalAddress(); Get the local address the socket is connected to.
int getLocalPort(); Get the local port.
int getPort(); Get the peer's port number.
int getReceiveBufferSize();
void setReceiveBufferSize(int size); Get/set receive-buffer's size.
int getSendBufferSize();
void setSendBufferSize(int size); Get/set send-buffer's size.
int getSoTimeout();
void setSoTimeout(int timeout); Get/set the timeout for I/O. If enabled, reading the pipe aborts after specified time.
void receive(DatagramPacket p); Receive message.
void send(DatagramPacket p); Send message.
Exceptions Thrown
IOException, SocketException,