Package jmri.jmrix.bidib.tcpserver
Class TcpServerNetMessageHandler
- java.lang.Object
-
- jmri.jmrix.bidib.tcpserver.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
-
-
-
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 interfaceorg.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 interfaceorg.bidib.jbidibc.net.serialovertcp.NetMessageHandler
- Parameters:
port
- the portdata
- the data
-
acceptClient
public void acceptClient(java.lang.String remoteHost)
- Specified by:
acceptClient
in interfaceorg.bidib.jbidibc.net.serialovertcp.NetMessageHandler
-
cleanup
public void cleanup(java.lang.String remoteHost)
- Specified by:
cleanup
in interfaceorg.bidib.jbidibc.net.serialovertcp.NetMessageHandler
-
-