From 46465cf1043190c782ccd0206e9f4e524546090a Mon Sep 17 00:00:00 2001 From: Sinan Date: Mon, 8 Oct 2018 11:32:25 +0200 Subject: [PATCH 1/3] Improve tcp connection establishment Somehow the .Net class TcpClient is really weird. See: #2770 See also: https://stackoverflow.com/questions/18390715/why-is-the-tcpclient-slower-to-connect-with-parameters-in-the-constructor --- rsb-cil/Rsb/Transport/Socket/BusClientConnection.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rsb-cil/Rsb/Transport/Socket/BusClientConnection.cs b/rsb-cil/Rsb/Transport/Socket/BusClientConnection.cs index 87eddbe..058dda3 100644 --- a/rsb-cil/Rsb/Transport/Socket/BusClientConnection.cs +++ b/rsb-cil/Rsb/Transport/Socket/BusClientConnection.cs @@ -32,8 +32,10 @@ namespace Rsb.Transport.Socket { LOGGER.Debug("Activating"); - - this.client = new TcpClient(host, port); + // fix, see + // https://stackoverflow.com/questions/18390715/why-is-the-tcpclient-slower-to-connect-with-parameters-in-the-constructor + this.client = new TcpClient(); + this.client.Connect(host, port); this.client.NoDelay = true; this.stream = client.GetStream(); -- 2.14.2.windows.1