public void Start() { const int port = 5689; const int numConnections = 10; const int bufferSize = Int16.MaxValue; _socketListener = new SocketListener(numConnections, bufferSize); _socketListener.Start(port); }
static void Main(string[] args) { //DateTime? dt = GetStandardDataTime(); //if (dt != null) //{ // DateTime localTime = Convert.ToDateTime(dt).AddHours(8); // TimeSpan ts = localTime - DateTime.Now; // if (Math.Abs(ts.Hours) > 0) // { //set system time // } //} try { Int32 port = 5689; Int32 numConnections = 10; Int32 bufferSize = Int16.MaxValue; SocketListener sl = new SocketListener(numConnections, bufferSize); sl.Start(port); Console.WriteLine("Server listening on port {0}. Press any key to terminate the server process...", port); Console.Read(); sl.Stop(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }