LoginServer.Systems.GetServerByEndPoint C# (CSharp) Method

GetServerByEndPoint() public static method

public static GetServerByEndPoint ( string ip, int port ) : SRX_Serverinfo
ip string
port int
return SRX_Serverinfo
        public static SRX_Serverinfo GetServerByEndPoint(string ip, int port)
        {
            SRX_Serverinfo GS = null;

            foreach (KeyValuePair<int, Systems.SRX_Serverinfo> GSI in GSList)
            {
                if (GSI.Value.ip == ip && GSI.Value.ipcport == port)
                {
                    GS = GSI.Value;
                }
            }
            return GS;
        }

Usage Example

コード例 #1
0
ファイル: Program.cs プロジェクト: Try-Parser/TestProjects
        public void OnIPC(Socket aSocket, EndPoint ep, byte[] data)
        {
            try
            {
                if (data.Length >= 6)
                {
                    /*string str;
                     * System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
                     * str = enc.GetString(data);*/

                    string[] ip_s = ep.ToString().Split(':');

                    Systems.SRX_Serverinfo remoteGameServer = Systems.GetServerByEndPoint(ip_s[0], UInt16.Parse(ip_s[1]));
                    if (remoteGameServer != null)
                    {
                        // decode data
                        //Network.Servers.IPCdeCode(ref data, remoteGameServer.code);

                        Systems.PacketReader pack = new Systems.PacketReader(data);
                        short pcmd = pack.Int16();
                        if (data.Length >= 6)
                        {
                            switch (pcmd)
                            {
                            default:
                                LogDebug.Show("[IPC] unknown command recevied {0:x}", pcmd);
                                break;
                            }
                        }
                        else
                        {
                            LogDebug.Show("[IPC] data to short");
                        }
                    }
                    else
                    {
                        LogDebug.Show("[IPC] can't find the GameServer {0}:{1}", ((IPEndPoint)ep).Address.ToString(), ip_s[1]);
                    }
                }
                else
                {
                    LogDebug.Show("[IPC] packet to short from {0}", ep.ToString());
                }
            }
            catch (Exception ex)
            {
                LogDebug.Show("[IPC.OnIPC] {0}", ex);
            }
        }
All Usage Examples Of LoginServer.Systems::GetServerByEndPoint