Package 

Class MultiplexingSocket

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public class MultiplexingSocket
    extends DelegatingSocket
                        

    Represents a Socket which allows filtering DatagramPackets it reads from the network using DatagramPacketFilters so that the DatagramPackets do not get received through it but through associated MultiplexedSockets.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      InputStream getInputStream()
      int getSoTimeout()
      void setSoTimeout(int timeout)
      InputStream getOriginalInputStream() Get original InputStream.
      OutputStream getOriginalOutputStream() Get original OutputStream.
      MultiplexedSocket getSocket(DatagramPacketFilter filter) Gets a MultiplexedDatagramSocket which filters DatagramPackets away from this DatagramSocket using a specific DatagramPacketFilter.
      void receive(DatagramPacket p) Receives a datagram packet from this socket.
      • Methods inherited from class org.ice4j.socket.DelegatingSocket

        bind, close, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, receiveFromInputStream, send, sendUrgentData, setKeepAlive, setOOBInline, setOriginalInputStream, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
      • Methods inherited from class java.net.Socket

        bind, close, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setSocketImplFactory, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, supportedOptions, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultiplexingSocket

        MultiplexingSocket()
        Initializes a new MultiplexingSocket instance.
      • MultiplexingSocket

        MultiplexingSocket(InetAddress address, int port)
        Initializes a new MultiplexingSocket instance.
        Parameters:
        address - not used
        port - not used
      • MultiplexingSocket

        MultiplexingSocket(InetAddress address, int port, InetAddress localAddr, int localPort)
        Initializes a new MultiplexingSocket instance.
        Parameters:
        address - not used
        port - not used
        localAddr - not used
        localPort - not used
      • MultiplexingSocket

        MultiplexingSocket(Proxy proxy)
        Initializes a new MultiplexingSocket instance.
        Parameters:
        proxy - not used
      • MultiplexingSocket

        MultiplexingSocket(Socket socket)
        Initializes a new MultiplexingSocket instance.
        Parameters:
        socket - delegate socket
      • MultiplexingSocket

        MultiplexingSocket(String host, int port)
        Initializes a new MultiplexingSocket instance.
        Parameters:
        host - not used
        port - not used
      • MultiplexingSocket

        MultiplexingSocket(String host, int port, InetAddress localAddr, int localPort)
        Initializes a new MultiplexingSocket instance.
        Parameters:
        host - not used
        port - not used
        localAddr - not used
        localPort - not used
    • Method Detail

      • getSocket

         MultiplexedSocket getSocket(DatagramPacketFilter filter)

        Gets a MultiplexedDatagramSocket which filters DatagramPackets away from this DatagramSocket using a specific DatagramPacketFilter. If such a MultiplexedDatagramSocket does not exist in this instance, it is created.

        Parameters:
        filter - the DatagramPacketFilter to get a MultiplexedDatagramSocket for
      • receive

         void receive(DatagramPacket p)

        Receives a datagram packet from this socket. The DatagramPackets returned by this method do not match any of the DatagramPacketFilters of the MultiplexedDatagramSockets associated with this instance at the time of their receipt. When this method returns, the DatagramPacket's buffer is filled with the data received. The datagram packet also contains the sender's IP address, and the port number on the sender's machine.

        This method blocks until a datagram is received. The length field of the datagram packet object contains the length of the received message. If the message is longer than the packet's length, the message is truncated.

        Parameters:
        p - the DatagramPacket into which to place the incoming data