public class UDPSocket
extends java.lang.Object
Constructor and Description |
---|
UDPSocket(java.lang.String hostname,
int port) |
UDPSocket(java.lang.String serverName,
int serverPort,
int bufferSize) |
UDPSocket(java.lang.String serverName,
int serverPort,
java.lang.String hostname,
int port,
int bufferSize,
int timeout) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.net.InetAddress |
getLocalAddress() |
int |
getLocalPort() |
java.net.DatagramSocket |
getSocket() |
int |
getTimeout() |
boolean |
isConnected() |
static void |
main(java.lang.String[] args) |
java.lang.String |
receive() |
void |
receive(java.net.DatagramPacket p) |
void |
receive(XQueue xq)
get a used packet from XQ first and send the received packet to XQ
if the used packet is null, create a new packet for use
|
int |
reconnect() |
void |
send(byte[] buffer,
int offset,
int length) |
void |
send(java.net.DatagramPacket p) |
void |
send(java.lang.String text) |
void |
send(XQueue xq) |
void |
setSleepTime(int ms) |
void |
setTimeout(int timeout) |
void |
setWaitTime(int ms) |
public UDPSocket(java.lang.String hostname, int port)
public UDPSocket(java.lang.String serverName, int serverPort, int bufferSize)
public UDPSocket(java.lang.String serverName, int serverPort, java.lang.String hostname, int port, int bufferSize, int timeout)
public int reconnect()
public void close()
public boolean isConnected()
public java.net.InetAddress getLocalAddress()
public int getLocalPort()
public int getTimeout()
public java.net.DatagramSocket getSocket()
public void setTimeout(int timeout)
public void setSleepTime(int ms)
public void setWaitTime(int ms)
public void send(java.net.DatagramPacket p) throws java.io.IOException
java.io.IOException
public void send(byte[] buffer, int offset, int length) throws java.io.IOException
java.io.IOException
public void send(java.lang.String text) throws java.io.IOException
java.io.IOException
public void send(XQueue xq) throws java.io.IOException
java.io.IOException
public void receive(java.net.DatagramPacket p) throws java.io.IOException
java.io.IOException
public void receive(XQueue xq) throws java.io.IOException
java.io.IOException
public java.lang.String receive() throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)