コード例 #1
0
        internal static bool TestCase()
        {
#if NoAutoCSer
#else
            using (Session.TcpInternalServer server = new Session.TcpInternalServer())
            {
                if (server.IsListen)
                {
                    using (Session.TcpInternalClient clientA = new Session.TcpInternalClient(null, new veify("userA", "A").Verify))
                        using (Session.TcpInternalClient clientB = new Session.TcpInternalClient(null, new veify("userB", "B").Verify))
                            using (Session.TcpInternalClient clientC = new Session.TcpInternalClient(null, new veify("userC", "C").Verify))
                                using (Session.TcpInternalClient clientD = new Session.TcpInternalClient(null, new veify("userD", "D").Verify))
                                    using (Session.TcpInternalClient clientE = new Session.TcpInternalClient(null, new veify("userE", "E").Verify))
                                        using (Session.TcpInternalClient clientF = new Session.TcpInternalClient(null, new veify("userF", "F").Verify))
                                            using (Session.TcpInternalClient clientG = new Session.TcpInternalClient(null, new veify("userG", "G").Verify))
                                                using (Session.TcpInternalClient clientH = new Session.TcpInternalClient(null, new veify("userH", "H").Verify))
                                                {
                                                    if (clientA.myName().Value != "userA")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientB.myName().Value != "userB")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientC.myName().Value != "userC")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientD.myName().Value != "userD")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientE.myName().Value != "userE")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientF.myName().Value != "userF")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientG.myName().Value != "userG")
                                                    {
                                                        return(false);
                                                    }
                                                    if (clientH.myName().Value != "userH")
                                                    {
                                                        return(false);
                                                    }
                                                }
                    return(true);
                }
            }
#endif
            return(false);
        }
コード例 #2
0
 /// <summary>
 /// 客户端验证
 /// </summary>
 /// <param name="client"></param>
 /// <param name="sender"></param>
 /// <returns></returns>
 public bool Verify(Session.TcpInternalClient client, AutoCSer.Net.TcpInternalServer.ClientSocketSender sender)
 {
     return(client.login(sender, user, password).Value);
 }