|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.objectwave.networkUtility.UDPUtils
UDP is commonly used for broadcast capabilities. By sending to the highest ip of a network address, all subnet members will receive the UDP packet. A network address is the IP address of a machines bit wised anded with the network mask. example: 206.20.164.18 is my machine's IP. 255.255.255.0 is my subnet mask. 206.20.164.0 is our network address. 206.20.164.255 is the standard broadcast address. However, it may be better to use a multicast socket instead.
| Constructor Summary | |
UDPUtils()
|
|
| Method Summary | |
void |
close()
|
java.lang.Object |
receiveObjectUDP(int portNumber)
Retrieve an object on the specified port number. |
static byte[] |
receiveUDP(int numBytes,
int portNumber)
Receive a UDP packet from a local UDP port, as an array of bytes. |
void |
sendObjectUDP(java.lang.Object o,
java.lang.String host,
int portNumber)
|
static void |
sendUDP(byte[] msg,
java.lang.String host,
int portNumber)
Send a byte array as a UDP packet to some host & port. |
static void |
setVerbose(boolean state)
Sets the Verbose attribute of the UDPUtils class |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public UDPUtils()
| Method Detail |
public static void setVerbose(boolean state)
state - The new Verbose value
public static byte[] receiveUDP(int numBytes,
int portNumber)
throws java.net.SocketException,
java.io.IOException
numBytes - portNumber -
java.net.SocketException
java.io.IOException
public static void sendUDP(byte[] msg,
java.lang.String host,
int portNumber)
throws java.net.SocketException,
java.io.IOException,
java.net.UnknownHostException
msg - host - portNumber -
java.net.SocketException
java.io.IOException
java.net.UnknownHostExceptionpublic void close()
public java.lang.Object receiveObjectUDP(int portNumber)
portNumber -
public void sendObjectUDP(java.lang.Object o,
java.lang.String host,
int portNumber)
o - host - portNumber -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||