コード例 #1
0
        private static void ListenIncommingLayerConnections(IAsyncResult ar)
        {
            PRoConLayer plLayer = (PRoConLayer)ar.AsyncState;

            if (plLayer.m_tclLayerListener != null)
            {
                try {
                    TcpClient tcpNewConnection = plLayer.m_tclLayerListener.EndAcceptTcpClient(ar);

                    PRoConLayerClient cplcNewConnection = new PRoConLayerClient(new FrostbiteLayerConnection(tcpNewConnection), plLayer.m_praApplication, plLayer.m_prcClient);

                    plLayer.LayerClients.Add(cplcNewConnection);

                    if (plLayer.ClientConnected != null)
                    {
                        FrostbiteConnection.RaiseEvent(plLayer.ClientConnected.GetInvocationList(), cplcNewConnection);
                    }

                    plLayer.m_tclLayerListener.BeginAcceptTcpClient(plLayer.m_asyncAcceptCallback, plLayer);
                }
                catch (SocketException exception) {
                    if (plLayer.LayerSocketError != null)
                    {
                        FrostbiteConnection.RaiseEvent(plLayer.LayerSocketError.GetInvocationList(), exception);
                    }

                    plLayer.ShutdownLayerListener();

                    //cbfAccountsPanel.OnLayerServerSocketError(skeError);
                }
                catch (Exception) {
                }
            }
        }
コード例 #2
0
ファイル: PRoConClient.cs プロジェクト: phelom/Procon-1
        public PRoConClient(PRoConApplication praApplication, string hostName, ushort port, string username, string password) {
            HostName = hostName;
            Port = port;
            Password = password;
            _username = username;
            //this.m_uscParent = frmParent;
            Parent = praApplication;

            ProconEventsUid = String.Empty;

            m_dicForwardedPackets = new Dictionary<UInt32, SOriginalForwardedPacket>();

            Tasks = new List<Task>();
            VersionNumber = String.Empty;

            Layer = new PRoConLayer();

            m_dicUsernamesToUids = new Dictionary<string, string>() {
                {"SYSOP", ""}
            };
            InstigatingAccountName = String.Empty;

            PluginMaxRuntimeSpan = new TimeSpan(0, Parent.OptionsSettings.PluginMaxRuntime_m, Parent.OptionsSettings.PluginMaxRuntime_s);
        }