public void Reconnect() { if (this.InvokeRequired) { ReconnectDelegate delegado = new ReconnectDelegate(Reconnect); this.Invoke(delegado, new object[] { }); } else { ((Modulo.UBSTwincatComModule)parent).Reconnect(); } }
public EasyTcpClient(TcpChannelEventHandler <TcpChannelReceivedEventArgs> onReceived, string id = null, int receiveTimeoutInSec = DEFAULT_RECEIVE_TIMEOUT_IN_SEC, int reconnectionAttempts = DEFAULT_RECONNECTION_ATTEMPTS, int delayBetweenReconnectionAttemptsInSec = DEFAULT_RECONNECTION_DELAY_IN_SEC, int socketReceiveTimeoutInSec = DEFAULT_RECEIVE_TIMEOUT_IN_SEC, int socketSendTimeoutInSec = DEFAULT_SEND_TIMEOUT_IN_SEC, int socketReceiveBufferSize = DEFAULT_RECEIVE_BUFFER_SIZE, int socketSendBufferSize = DEFAULT_SEND_BUFFER_SIZE) : base(onReceived, id, socketReceiveTimeoutInSec, socketSendTimeoutInSec, socketReceiveBufferSize, socketSendBufferSize) { dlgtReconnect = new ReconnectDelegate(Connect); this.m_ReconnectionAttempts = reconnectionAttempts; if (this.m_ReconnectionAttempts <= 0) { this.m_ReconnectionAttempts = 1; } this.m_DelayBetweenReconnectionAttempts = new TimeSpan(0, 0, delayBetweenReconnectionAttemptsInSec); }