public class UdpSocket
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
UdpSocket()
Creates a new void UdpSocket
|
protected |
UdpSocket(java.net.DatagramSocket sock)
Creates a new UdpSocket
|
|
UdpSocket(int port)
Creates a new UdpSocket
|
|
UdpSocket(int port,
IpAddress ipaddr)
Creates a new UdpSocket
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this datagram socket.
|
IpAddress |
getLocalAddress()
Gets the local address to which the socket is bound.
|
int |
getLocalPort()
Gets the port number on the local host to which this socket is bound.
|
long |
getReceiverBufferSize()
Gets the buffer size used by the platform for input on this UDP socket.
|
long |
getReceiverOctectCounter()
Gets the total number of received octects.
|
long |
getReceiverPacketCounter()
Gets the total number of received packets.
|
long |
getSenderOctectCounter()
Gets the total number of sent octects.
|
long |
getSenderPacketCounter()
Gets the total number of sent packets.
|
int |
getSoTimeout()
Gets the socket timeout.
|
void |
receive(UdpPacket pkt)
Receives a datagram packet from this socket.
|
void |
send(UdpPacket pkt)
Sends an UDP packet from this socket.
|
void |
setReceiverBufferSize(int size)
Sets the buffer size used by the platform for input on this UDP socket.
|
void |
setSoTimeout(int timeout)
Enables/disables socket timeout with the specified timeout, in milliseconds.
|
java.lang.String |
toString()
Converts this object to a String.
|
protected UdpSocket()
protected UdpSocket(java.net.DatagramSocket sock)
public UdpSocket(int port) throws java.net.SocketException
java.net.SocketException
public UdpSocket(int port, IpAddress ipaddr) throws java.net.SocketException
java.net.SocketException
public void close()
public IpAddress getLocalAddress()
public int getLocalPort()
public int getSoTimeout() throws java.net.SocketException
java.net.SocketException
public void setSoTimeout(int timeout) throws java.net.SocketException
java.net.SocketException
public void receive(UdpPacket pkt) throws java.io.IOException
java.io.IOException
public void send(UdpPacket pkt) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public long getSenderPacketCounter()
public long getSenderOctectCounter()
public long getReceiverPacketCounter()
public long getReceiverOctectCounter()
public long getReceiverBufferSize() throws java.net.SocketException
java.net.SocketException
public void setReceiverBufferSize(int size) throws java.net.SocketException
size
- the receiver buffer sizejava.net.SocketException