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