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); } }
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)); } }
public static void SendOut(string request, string hostName, bool enableException = true) { using (TcpJsonClient client = new TcpJsonClient(hostName)) { client.IsDuplex = false; client.Execute(request, enableException); } }
//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)); } }
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)); } }