public void Start()
{
lock (m_lock)
{
m_connections = new List<Connection>();
IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, m_listenerUrl.Port);
m_listeningSocket = new Socket(endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
m_listeningSocket.Bind(endpoint);
m_listeningSocket.Listen(Int32.MaxValue);
m_listeningSocket.BeginAccept(OnAccept, m_listeningSocket);
}
}
private void StartBTN_Click(object sender, EventArgs e) { try { if (m_server != null) { m_server.Stop(); m_server = null; } m_server = new Server(ListenerUrlTB.Text, ServerUrlTB.Text); m_server.Start(); StopBTN.Enabled = true; } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }