当前位置: 首页>>代码示例>>C#>>正文


C# SocketClient.Disconnect方法代码示例

本文整理汇总了C#中SocketClient.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# SocketClient.Disconnect方法的具体用法?C# SocketClient.Disconnect怎么用?C# SocketClient.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SocketClient的用法示例。


在下文中一共展示了SocketClient.Disconnect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CharacterSelect

        public static void CharacterSelect(byte[] packet, SocketClient sockstate)
        {
            String Name;
            int CID = 0;
            bool loginsuccess = true;

            CMSG_CHARACTER_SELECT cpkt = (CMSG_CHARACTER_SELECT)packet;
            Name = cpkt.Name;

            foreach(Mobile character in sockstate.Account.Characters)
            {
                if (character.Name == Name)
                {
                    CID = character.CID;
                    loginsuccess = true;
                }
            }

            if (loginsuccess == true)
            {
                SMSG_CHARACTER_SELECT spkt = new SMSG_CHARACTER_SELECT(Name);
                sockstate.Client.PacketQueue.Enqueue(spkt.Stream);

                SMSG_CHANNEL_SLIME slimePkt = new SMSG_CHANNEL_SLIME();
                sockstate.Client.PacketQueue.Enqueue(slimePkt.Stream);

                sockstate.SelectedChar = CID;
            }
            else
            {
                Logger.Log(Logger.LogLevel.Error, "Hack Detection", "Account: {0} - Invalid Select Character Name: {1}", sockstate.Account.Username, Name);
                sockstate.Disconnect();
            }
        }
开发者ID:LuJie,项目名称:avalon,代码行数:34,代码来源:Client.Character.cs

示例2: AddSession

        public static void AddSession(byte[] packet, SocketClient sockstate)
        {
            int cid;

            CMSG_ADD_SESSION cpkt = (CMSG_ADD_SESSION)packet;

            cid = cpkt.cid;

            lock (Program.CharacterList)
            {
                if (!Program.CharacterList.ContainsKey(cid))
                {
                    Program.CharacterList.Add(cid, new Character(cid));
                }
                else
                {
                    Logger.Log(Logger.LogLevel.Hack, "Hack Detection", "Session tampering detected : {0}", ((IPEndPoint)sockstate.Client.Socket.RemoteEndPoint).Address.ToString());
                    sockstate.Disconnect();
                }
            }
        }
开发者ID:mabinogidev,项目名称:mabinogi-development,代码行数:21,代码来源:Client.General.cs

示例3: Disconnect

 public static void Disconnect(byte[] packet, SocketClient sockstate)
 {
     sockstate.Disconnect();
 }
开发者ID:LuJie,项目名称:avalon,代码行数:4,代码来源:Client.General.cs

示例4: canConnectTo

 private bool canConnectTo(Instance info)
 {
     var client = new SocketClient();
     client.Connect(info.Port, (s) => {});
     var connected = client.IsConnected;
     client.Disconnect();
     if (!connected)
         File.Delete(info.File);
     return connected;
 }
开发者ID:acken,项目名称:OpenIDE,代码行数:10,代码来源:PkgTestHandler.cs

示例5: JoinStage

        public static void JoinStage(byte[] packet, SocketClient sockstate)
        {
            int sessionid;

            CMSG_GET_SESSION cpkt = (CMSG_GET_SESSION)packet;
            sessionid = cpkt.Session;

            lock (Program.CharacterList)
            {
                if (Program.CharacterList.ContainsKey(sessionid))
                {
                    sockstate.Character = Program.CharacterList[sessionid];
                    if (!Database.LoadCharacter(sessionid))
                    {
                        Logger.Log(Logger.LogLevel.Error, "Client General", "Failed to load character for cid {0}", sessionid);
                    }
                }
                else
                {
                    Logger.Log(Logger.LogLevel.Hack, "Hack Detection", "Session tampering detected : {0}", ((IPEndPoint)sockstate.Client.Socket.RemoteEndPoint).Address.ToString());
                    sockstate.Disconnect();
                    return;
                }
            }

            // Client ignores this packet, even though it's sent on official.
            // SMSG_STAGE_INFO stagePkt = new SMSG_STAGE_INFO(sockstate.Character.Name);

            SMSG_CHARACTER_INFO charPkt = new SMSG_CHARACTER_INFO(sockstate.Character);
            SMSG_BAG_INFO bagPkt = new SMSG_BAG_INFO(sockstate);

            sockstate.Client.PacketQueue.Enqueue(charPkt.Stream);
            sockstate.Client.PacketQueue.Enqueue(bagPkt.Stream);

            // Ingored by client
            byte[] one = {
            0x30, 0x00, 0xe0, 0x55, 0x8d, 0xfa, 0xcc, 0xe1,
            0x3c, 0x39, 0x01, 0x00, 0x00, 0x00, 0x62, 0x53,
            0xa9, 0xda, 0x02, 0x00, 0x00, 0x00, 0xaf, 0xd5,
            0x69, 0x17, 0x0f, 0x27, 0x01, 0x00, 0x01, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0xe9, 0xcd, 0x3c, 0x39, 0x00, 0x00, 0x00, 0x00 };

            byte[] two = {
            0xaf, 0x00, 0xe0, 0x55, 0xf3, 0x2c, 0x31, 0xee,
            0x3c, 0x39, 0x07, 0x00, 0x00, 0x00, 0x62, 0x53,
            0xd3, 0x13, 0xf2, 0xfb, 0x8f, 0x00, 0xca, 0x5d,
            0x3e, 0x61, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x53, 0xd3,
            0x13, 0x78, 0x8a, 0x05, 0x00, 0xca, 0x5d, 0x3e,
            0x61, 0x01, 0x01, 0x14, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x64, 0x53, 0xd3, 0x13,
            0x90, 0xbb, 0x52, 0x02, 0xca, 0x5d, 0x3e, 0x61,
            0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x65, 0x53, 0xd3, 0x13, 0x91,
            0xbb, 0x52, 0x02, 0xca, 0x5d, 0x3e, 0x61, 0x01,
            0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x66, 0x53, 0xd3, 0x13, 0x92, 0xbb,
            0x52, 0x02, 0xca, 0x5d, 0x3e, 0x61, 0x01, 0x04,
            0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x67, 0x53, 0xd3, 0x13, 0x93, 0xbb, 0x52,
            0x02, 0xca, 0x5d, 0x3e, 0x61, 0x01, 0x05, 0x01,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x68, 0x53, 0xd3, 0x13, 0x94, 0xbb, 0x52, 0x02,
            0xca, 0x5d, 0x3e, 0x61, 0x01, 0x06, 0x01, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            byte[] three = {
            0x0e, 0x00, 0xe0, 0x55, 0x14, 0x74, 0x96, 0x1a,
            0x3c, 0x39, 0x00, 0x00, 0x00, 0x00 };
            byte[] four = {
            0x0e, 0x00, 0xe0, 0x55, 0x0f, 0x0e, 0xec, 0xc9,
            0x3c, 0x39, 0x00, 0x00, 0x00, 0x00 };
            byte[] five = {
            0x0e, 0x00, 0xe0, 0x55, 0xb6, 0x19, 0xad, 0x8c,
            0x8e, 0xce, 0x00, 0x00, 0x00, 0x00 };
            byte[] six = {
            0x12, 0x00, 0xe0, 0x55, 0xed, 0xd2, 0x00, 0x00,
            0x00, 0x00, 0xea, 0x13, 0x3c, 0x39, 0x00, 0x00,
            0x00, 0x00 };
            byte[] seven = {
            0x0e, 0x00, 0xe0, 0x55, 0x30, 0xfd, 0xa3, 0x11,
            0x3c, 0x39, 0x00, 0x00, 0x00, 0x00 };

            sockstate.Client.PacketQueue.Enqueue(one);
            sockstate.Client.PacketQueue.Enqueue(two);
            sockstate.Client.PacketQueue.Enqueue(three);
            sockstate.Client.PacketQueue.Enqueue(four);
            sockstate.Client.PacketQueue.Enqueue(five);
            sockstate.Client.PacketQueue.Enqueue(six);
            sockstate.Client.PacketQueue.Enqueue(seven);
        }
开发者ID:mabinogidev,项目名称:mabinogi-development,代码行数:91,代码来源:Client.General.cs

示例6: canConnectTo

 private bool canConnectTo(Instance info)
 {
     var client = new SocketClient();
     client.Connect(info.Port, (s) => {});
     var connected = client.IsConnected;
     client.Disconnect();
     if (!connected) {
         try {
             Process.GetProcessById(info.ProcessID);
         } catch {
             File.Delete(info.File);
         }
     }
     return connected;
 }
开发者ID:continuoustests,项目名称:OpenIDE,代码行数:15,代码来源:PkgTestHandler.cs


注:本文中的SocketClient.Disconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。