Opc.Ua.NetworkTester.Server.Start C# (CSharp) Method

Start() public method

Starts listening at the specified port.
public Start ( ) : void
return void
        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);
            }
        }

Usage Example

Exemplo n.º 1
0
        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);
            }
        }