Beispiel #1
0
        public void AcceptThread()
        {
            try
            {
                while (Enabled)
                {
                    SocketCouple sc = new SocketCouple();

                    ManualResetEvent mre = new ManualResetEvent(false);

                    IAsyncResult res = sAccept.BeginAccept(new AsyncCallback((IAsyncResult ia) =>
                    {
                        bool fic = ia.IsCompleted;

                        sc.ClientBridgeSocket = sAccept.EndAccept(ia);

                        OnConnectionAccepted(sc.ClientBridgeSocket);

                        sc.BridgeSQLSocket = new Socket(SQLServerEndpoint.AddressFamily, SocketType.Stream, ProtocolType.IP);
                        sc.BridgeSQLSocket.Connect(SQLServerEndpoint);

                        BridgedConnection bc = new BridgedConnection(this, sc);
                        bc.Start();
                        mre.Set();
                    }), null);

                    mre.WaitOne();
                }
            }
            catch (Exception exce)
            {
                OnListeningThreadException(sAccept, exce);
            }
        }
Beispiel #2
0
 public BridgedConnection(BridgeAcceptor BridgeAcceptor, SocketCouple SocketCouple)
 {
     this.BridgeAcceptor = BridgeAcceptor;
     this.SocketCouple   = SocketCouple;
 }