Exemplo n.º 1
0
 public TcpMessage DeserializeFrom(BinaryReader p_binaryReader)
 {
     ID             = p_binaryReader.ReadInt32();
     ParamStr       = p_binaryReader.ReadString();
     ResponseFormat = (TcpMessageResponseFormat)p_binaryReader.ReadInt32();
     return(this);
 }
Exemplo n.º 2
0
        // p_vbMessageId: better to be general int than typed enum, because then this function can be used in general
        public static async Task <string?> Send(string p_msg, int p_vbMessageId, string p_tcpServerHost, int p_tcpServerPort, TcpMessageResponseFormat p_responseFormat = TcpMessageResponseFormat.String)
        {
            Utils.Logger.Info($"TcpMessage.Send(): Message: '{p_msg}'");

            var t = (new TcpMessage()
            {
                TcpServerHost = p_tcpServerHost,
                TcpServerPort = p_tcpServerPort,
                ID = p_vbMessageId,
                ParamStr = $"{p_msg}",
                ResponseFormat = p_responseFormat
            }.SendMessage());

            string?reply = (await t);

            return(reply);
        }