ist.palcom.base.networking
Class DatagramSocket
java.lang.Object
ist.palcom.base.Object
ist.palcom.base.Channel
ist.palcom.base.networking.DatagramSocket
- Direct Known Subclasses:
- MulticastSocket
public class DatagramSocket
- extends Channel
This class implements a JVM version of ist.palcom.base.DatagramSocket.
Before, it was implemented using Java non-blocking I/0 (Java NIO), but that
is apparently not supported for multicast (see, e.g.,
http://directory.apache.org/subprojects/network/faq.html#multicast), so now
it uses "normal" Java I/O.
|
Field Summary |
protected static boolean |
onlyLoopback
This flag is set if only the loopback interface is available. |
protected java.net.DatagramSocket |
socket
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
socket
protected java.net.DatagramSocket socket
onlyLoopback
protected static boolean onlyLoopback
- This flag is set if only the loopback interface is available. In that
case, localhost broadcast is used instead of multicast.
DatagramSocket
public DatagramSocket()
throws java.io.IOException
- Throws:
java.io.IOException
DatagramSocket
public DatagramSocket(int port)
throws java.io.IOException
- Throws:
java.io.IOException
createSocket
protected java.net.DatagramSocket createSocket()
throws java.io.IOException
- Throws:
java.io.IOException
createSocket
protected java.net.DatagramSocket createSocket(int port)
throws java.io.IOException
- Throws:
java.io.IOException
getPort
public int getPort()
send
public void send(DatagramPacket p)
throws java.io.IOException
- Throws:
java.io.IOException
receive
public DatagramPacket receive(int maxSize)
throws java.io.IOException
- Returns:
- A packet if a packet was received, nil otherwise.
- Throws:
java.io.IOException
close
public void close()
dataAvailable
public boolean dataAvailable()
- This method should only be called by the System class.
- See Also:
ist.palcom.base.Channel#dataAvailable()
getLocalAddress
public static java.lang.String getLocalAddress()
- Returns:
- The local host address (without port).
getReceiveBufferSize
public int getReceiveBufferSize()
throws java.io.IOException
- Throws:
java.io.IOException
getSendBufferSize
public int getSendBufferSize()
throws java.io.IOException
- Throws:
java.io.IOException
setReceiveBufferSize
public void setReceiveBufferSize(int size)
throws java.io.IOException
- Throws:
java.io.IOException
setSendBufferSize
public void setSendBufferSize(int size)
throws java.io.IOException
- Throws:
java.io.IOException