Esempio n. 1
0
 public static void SendOut(string request, string hostName, int port, int readTimeout, bool IsAsync, bool enableException = true)
 {
     using (TcpJsonClient client = new TcpJsonClient(hostName, port, readTimeout))
     {
         client.IsDuplex = false;
         client.Execute(request, enableException);
     }
 }
Esempio n. 2
0
 public static string SendDuplex(string request, string hostName, bool enableException = true)
 {
     using (TcpJsonClient client = new TcpJsonClient(hostName))
     {
         client.IsDuplex = true;
         return(client.Execute(request, enableException));
     }
 }
Esempio n. 3
0
 public static void SendOut(string request, string hostName, bool enableException = true)
 {
     using (TcpJsonClient client = new TcpJsonClient(hostName))
     {
         client.IsDuplex = false;
         client.Execute(request, enableException);
     }
 }
Esempio n. 4
0
        //public static T SendDuplex<T>(TcpMessage message, string hostName, int port, int readTimeout, bool IsAsync, bool enableException = true)
        //{
        //    string request = JsonSerializer.Serialize(message);
        //    using (TcpJsonClient client = new TcpJsonClient(hostName, port, readTimeout))
        //    {
        //        client.IsDuplex = true;
        //        string response = client.Execute(request, enableException);
        //        return JsonSerializer.Deserialize<T>(response);
        //    }
        //}

        public static T SendDuplex <T>(string request, string hostName, int port, int readTimeout, bool IsAsync, bool enableException = true)
        {
            using (TcpJsonClient client = new TcpJsonClient(hostName, port, readTimeout))
            {
                client.IsDuplex = true;
                string response = client.Execute(request, enableException);
                return(JsonSerializer.Deserialize <T>(response));
            }
        }
Esempio n. 5
0
 public static string SendDuplex(string request, string hostAddress, int port, int timeout, bool IsAsync = false, bool enableException = true)
 {
     using (TcpJsonClient client = new TcpJsonClient(hostAddress, port, timeout))
     {
         client.IsAsync  = IsAsync;
         client.IsDuplex = true;
         return(client.Execute(request, enableException));
     }
 }