address ( ) |
|
Return the actual socket's local address, or null if the
address correspond to any local address.
|
broadcast ( ) |
|
Enables or disables the ability of the current process to send broadcast
messages.
|
close ( ) |
|
Close the actuel datagram socket and all associate resources.
|
dispose ( ) |
|
Close the socket. This method is automatically called by Processing when
the PApplet shuts down.
|
getBuffer ( ) |
|
Return the actual socket buffer length
|
getTimeToLive ( ) |
|
Return the "Time to Live" value or -1 if an error occurred (or if
the current socket is not a multicast socket).
|
isBroadcast ( ) |
|
Returns whether the opened socket send broadcast message socket or not.
|
isClosed ( ) |
|
Returns whether the current socket is closed or not.
|
isJoined ( ) |
|
Returns whether the multicast socket is joined to a group address.
|
isListening ( ) |
|
Returns whether the socket wait for incoming data or not.
|
isLoopback ( ) |
|
Returns whether the multicast socket loopback mode is enable or not.
|
isMulticast ( ) |
|
Returns whether the opened datagram socket is a multicast socket or not.
|
listen ( ) |
|
Wait for incoming data, and call the appropriate handlers each time a
message is received. If the owner's class own the appropriate target
handler, this method send it the receive message as byte[], the sender
IP address and port.
This method force the current Thread to be ceased for a
temporary period. If you prefer listening without blocking the current
thread, use the {@link UDP#listen(int millis)} or
{@link UDP#listen(boolean on)} method instead.
|
log ( ) |
|
Enable or disable output process log.
|
loopback ( ) |
|
Enable or disable the multicast socket loopback mode. By default loopback
is enable.
Setting loopback to false means this multicast socket does not want to
receive the data that it sends to the multicast group.
|
port ( ) |
|
Return the actual socket's local port, or -1 if the socket is closed.
|
run ( ) |
|
Wait for incoming datagram packets. This method is called automaticlly,
you do not need to call it.
|
send ( ) |
|
Send data to the requested IP address and port.
A null IP address will assign the packet address to the
local host. Use this method to send data to another application by
passing null as the destination address.
|
setBuffer ( ) |
|
Set the maximum size of the packet that can be sent or receive on the
current socket. This value must be greater than 0, otherwise the buffer
size is set to the his default value.
return true if the new buffer value have been correctly set,
false otherwise.
note : this method has no effect if the socket is listening. To define
a new buffer size, call this method before implementing a new buffer in
memory. Explicitly before calling a receive methods.
|
setReceiveHandler ( ) |
|
Register the target's receive handler.
By default, this method name is "receive" with one argument
representing the received data as byte[] . For more
flexibility, you can change this method with another useful method by
passing his name. You could get more informations by implementing two
additional arguments, a String representing the sender IP
address and a int representing the sender port :
void myCustomReceiveHandler(byte[] message, String ip, int port) {
// do something here...
}
|
setTimeToLive ( ) |
|
Control the life-time of a datagram in the network for multicast packets
in order to indicates the scope of the multicasts (ie how far the packet
will travel).
The TTL value must be in range of 0 to 255 inclusive. The larger the
number, the farther the multicast packets will travel (by convention):
0 -> restricted to the same host
1 -> restricted to the same subnet (default)
<32 -> restricted to the same site
<64 -> restricted to the same region
<128 -> restricted to the same continent
<255 -> no restriction
The default value is 1, meaning that the datagram will not go beyond the
local subnet.
return true if no error occured.
|
setTimeoutHandler ( ) |
|
Register the target's timeout handler. By default, this method name is
"timeout" with no argument.
|