static void Main(string[] args) { _ServerIp = InputString("Server IP :", "127.0.0.1", false); _ServerPort = InputInteger("Server Port :", 9000, true, false); /* * _Ssl = InputBoolean("Use SSL :", false); * * if (_Ssl) * { * _PfxFilename = InputString("PFX Certificate File:", "simpletcp.pfx", false); * _PfxPassword = InputString("PFX File Password:"******"simpletcp", false); * } * * _Client = new SimpleTcpClient(_ServerIp, _ServerPort, _Ssl, _PfxFilename, _PfxPassword); */ // _Client = new SimpleTcpClient((_ServerIp + ":" + _ServerPort)); _Client = new SimpleTcpClient(_ServerIp, _ServerPort); _Client.Events.Connected += Connected; _Client.Events.Disconnected += Disconnected; _Client.Events.DataReceived += DataReceived; _Client.Keepalive.EnableTcpKeepAlives = true; _Client.Settings.MutuallyAuthenticate = false; _Client.Settings.AcceptInvalidCertificates = true; _Client.Settings.ConnectTimeoutMs = 5000; _Client.Logger = Logger; // _Client.Connect(); _Client.ConnectWithRetries(5000); while (_RunForever) { string userInput = InputString("Command [? for help]:", null, false); switch (userInput) { case "?": Menu(); break; case "q": case "Q": _RunForever = false; break; case "c": case "C": case "cls": Console.Clear(); break; case "send": Send(); break; case "sendasync": SendAsync(); break; case "connected": IsConnected(); break; case "dispose": _Client.Dispose(); break; case "stats": Console.WriteLine(_Client.Statistics.ToString()); break; case "connect": _Client.Connect(); break; case "disconnect": _Client.Disconnect(); break; case "stats reset": _Client.Statistics.Reset(); break; } } }
public void ConnectWithRetries(int timeoutMs) { _client.ConnectWithRetries(timeoutMs); }