示例#1
0
        void Delivery_OnDisconnected(DeliveryConnection conn)
        {
            // decrement the counter keeping track of the total number of clients connected to the server
            m_maxNumberAcceptedClients.Release();

            ReceiveEventArgs_Release(conn.receiveEventArgs);

            connMap.TryRemove(conn.GetHashCode(), out _);

            //conn.Close();
        }
示例#2
0
        private DeliveryConnection Delivery_OnConnected(global::System.Net.Sockets.Socket socket)
        {
            var conn = new DeliveryConnection();

            conn.Init(socket);

            conn.Conn_OnDisconnected = Delivery_OnDisconnected;

            connMap[conn.GetHashCode()] = conn;
            try
            {
                Conn_OnConnected?.Invoke(conn);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            return(conn);
        }