/// <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); })); }