예제 #1
0
        private void AcceptGatewayCallback(IAsyncResult result)
        {
            SilkroadTunnel silkroadTunnel = null;
            try
            {
                //CA2000 don't care
                silkroadTunnel = new SilkroadTunnel(this, _gatewayTunnels, null);
                silkroadTunnel.LocalClient = _gwLocalServer.EndAccept(result);
                UpdateNotify("Gateway Local connection has been made !");

                lock (_gatewayTunnels)
                {
                    _gatewayTunnels.Add(silkroadTunnel);
                    UpdateLabelStartGameButton(HasConnectedClient());
                }

                AcceptGatewayConnection();

                silkroadTunnel.Start();
            }
            catch (Exception exception)
            {
                if (silkroadTunnel != null)
                {
                    silkroadTunnel.Dispose();
                }
                MessageBox.Show(exception.ToString());
            }
        }
예제 #2
0
        private void AcceptAgentCallback(IAsyncResult result)
        {
            SilkroadTunnel silkroadTunnel = null;
            try
            {
                KeyValuePair<string, ushort> kvp = (KeyValuePair<string, ushort>)result.AsyncState;
                silkroadTunnel = new SilkroadTunnel(this, _agentTunnels, _mainForm);
                silkroadTunnel.SetRemoteServerAddress(kvp.Key, kvp.Value);
                silkroadTunnel.LocalClient = _agLocalServer.EndAccept(result);
                UpdateNotify("Agent local connection has been made !");
                lock (_agentTunnels)
                {
                    _agentTunnels.Add(silkroadTunnel);
                    UpdateLabelStartGameButton(HasConnectedClient());
                }

                silkroadTunnel.Start();

            }
            catch (Exception exception)
            {
                if (silkroadTunnel != null)
                {
                    silkroadTunnel.Dispose();
                }
                MessageBox.Show(exception.ToString());
            }
        }