Class TcpServerNetMessageHandler

  • All Implemented Interfaces:
    org.bidib.jbidibc.net.serialovertcp.NetMessageHandler

    public class TcpServerNetMessageHandler
    extends java.lang.Object
    implements org.bidib.jbidibc.net.serialovertcp.NetMessageHandler
    This is the network message handler for both directions. It receives the raw data from the TCP socket and forwards them to the message receiver. The send() message is called from the BiDiBMessageReceiver to send data from tge BiDIB connection back to the TCP client. Data is encoded with the serial encoder (i.e. add the Magic bytes etc.) and then sent to the NetBidibPort, which then finally send the messages to all connected clients.
    • Constructor Summary

      Constructors 
      Constructor Description
      TcpServerNetMessageHandler​(org.bidib.jbidibc.messages.MessageReceiver messageReceiverDelegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptClient​(java.lang.String remoteHost)  
      void cleanup​(java.lang.String remoteHost)  
      void receive​(org.bidib.jbidibc.net.serialovertcp.DataPacket packet)  
      void send​(org.bidib.jbidibc.net.serialovertcp.NetBidibPort port, byte[] data)
      Send serial encoded data (one or more messages) to the to the TCP port
      • Methods inherited from class java.lang.Object

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

      • TcpServerNetMessageHandler

        public TcpServerNetMessageHandler​(org.bidib.jbidibc.messages.MessageReceiver messageReceiverDelegate)
    • Method Detail

      • receive

        public void receive​(org.bidib.jbidibc.net.serialovertcp.DataPacket packet)
        Specified by:
        receive in interface org.bidib.jbidibc.net.serialovertcp.NetMessageHandler
      • send

        public void send​(org.bidib.jbidibc.net.serialovertcp.NetBidibPort port,
                         byte[] data)
        Send serial encoded data (one or more messages) to the to the TCP port
        Specified by:
        send in interface org.bidib.jbidibc.net.serialovertcp.NetMessageHandler
        Parameters:
        port - the port
        data - the data
      • acceptClient

        public void acceptClient​(java.lang.String remoteHost)
        Specified by:
        acceptClient in interface org.bidib.jbidibc.net.serialovertcp.NetMessageHandler
      • cleanup

        public void cleanup​(java.lang.String remoteHost)
        Specified by:
        cleanup in interface org.bidib.jbidibc.net.serialovertcp.NetMessageHandler