Beispiel #1
0
 /// <summary>
 /// Create an instance of TcpModelClient
 /// </summary>
 /// <param name="autoReconnect">True if the client can reconnect to server when disconnected automatically; otherwise, false.</param>
 /// <param name="modelHeaderIndicator">A 32-bits integer as the header to indicate the transmitted message is in the type of model.</param>
 /// <param name="packetSpliter">The spliter which is used to split stream data into packets.</param>
 public TcpModelClient(bool autoReconnect, int modelHeaderIndicator, IPacketSpliter packetSpliter) : base(autoReconnect, packetSpliter)
 {
     _modelHeaderIndicator = modelHeaderIndicator;
     _reqResponseAgent     = new RequestResponseAgent(new RelayRequestMessageSender(
                                                          () => RequestTimeOut,
                                                          (clientID, model) => SendModelMessage(model)));
 }
Beispiel #2
0
 /// <summary>
 /// Create an instance of TcpModelServer
 /// </summary>
 /// <param name="modelHeaderIndicator">A 32-bits integer as the header to indicate the transmitted message is in the type of model.</param>
 /// <param name="packetSpliter">The spliter used to split stream data into complete packets.</param>
 public TcpModelServer(int modelHeaderIndicator, IPacketSpliter packetSpliter)
     : base(packetSpliter)
 {
     _modelHeaderIndicator = modelHeaderIndicator;
     _reqResponseAgent     = new RequestResponseAgent(new RelayRequestMessageSender
                                                      (
                                                          () => RequestTimeOut,
                                                          (clientID, model) => SendModelMessage(clientID, model)
                                                      ));
 }
 /// <summary>
 /// Create an instance of TcpModelServer
 /// </summary>
 /// <param name="modelHeaderIndicator">A 32-bits integer as the header to indicate the transmitted message is in the type of model.</param>
 /// <param name="modelConvert">A converter between GeneralMessage and model.</param>
 public TcpModelServer(int modelHeaderIndicator, ModelMessageConvert modelConvert)
 {
     _modelHeaderIndicator = modelHeaderIndicator;
     _modelConvert         = modelConvert;
     _reqResponseAgent     = new RequestResponseAgent(new RelayRequestMessageSender(
                                                          () =>
     {
         return(RequestTimeOut);
     },
                                                          (clientID, model) =>
     {
         SendModelMessage(clientID, model);
     }));
 }
 /// <summary>
 /// Create an instance of TcpModelClient
 /// </summary>
 /// <param name="autoReconnect">True if the client can reconnect to server when disconnected automatically; otherwise, false.</param>
 /// <param name="modelHeaderIndicator">A 32-bits integer as the header to indicate the transmitted message is in the type of model.</param>
 /// <param name="modelConvert">A converter between GeneralMessage and model.</param>
 public TcpModelClient(bool autoReconnect, int modelHeaderIndicator, ModelMessageConvert modelConvert) : base(autoReconnect)
 {
     _modelHeaderIndicator = modelHeaderIndicator;
     _modelConvert         = modelConvert;
     _reqResponseAgent     = new RequestResponseAgent(new RelayRequestMessageSender(
                                                          () =>
     {
         return(RequestTimeOut);
     },
                                                          (clientID, model) =>
     {
         SendModelMessage(model);
     }));
 }