Exemple #1
0
        internal icSocket(AppClass App, string ConfigPath)
        {
            this.app = App;
            XmlDocument doc = new XmlDocument();
            doc.Load(ConfigPath + "Config.xml");
            XmlNodeList nodes = doc.GetElementsByTagName("Server");
            ip = nodes[0].Attributes.GetNamedItem("ip").InnerText;
            port = Convert.ToInt32(nodes[0].Attributes.GetNamedItem("port").InnerText);
            serverid = Convert.ToUInt16(nodes[0].Attributes.GetNamedItem("id").InnerText);
            XmlNodeList TimeOutnodes = doc.GetElementsByTagName("TimeOut");
            if (TimeOutnodes.Count > 0)
            {
                MinTimeOut = Convert.ToInt32(TimeOutnodes[0].Attributes.GetNamedItem("min").InnerText);
                MinNetSpeed = Convert.ToInt32(TimeOutnodes[0].Attributes.GetNamedItem("minnetspeed").InnerText);
            }

            sendouttimeThread = new Thread(sendouttimeThreadStart);
            sendThread = new Thread(sendThreadStart);
            recvThread = new Thread(recvThreadStart);
            heartThread = new Thread(heartThreadStart);
            sendThread.Priority = ThreadPriority.BelowNormal;
            sendThread.IsBackground = true;
            heartThread.Priority = ThreadPriority.Lowest;
            heartThread.IsBackground = true;
            recvThread.IsBackground = true;
            sendouttimeThread.IsBackground = true;
            sendouttimeThread.Priority = ThreadPriority.Lowest;
            heartThread.Start();
            sendThread.Start();
            recvThread.Start();
            sendouttimeThread.Start();
        }
Exemple #2
0
 internal static byte[] makeRegPacket(AppClass App)
 {
     const int PacketHeadSize = 4;
     const int CommnadSize = 2;
     const int AppIDSize = 2;
     const int AppTypeSize = 2;
     const int StringSize = 4;
     UInt16 AppID = (UInt16)App.id;
     UInt16 AppType = (UInt16)App.type;
     byte[] appname = Encoding.ASCII.GetBytes(App.appname);
     int appnamel = appname.Length;
     int length = CommnadSize + AppIDSize + AppTypeSize + StringSize + appname.Length;
     byte[] p = new byte[PacketHeadSize + length];
     p[0] = (byte)(length);
     p[1] = (byte)(length >> 8);
     p[2] = (byte)(length >> 16);
     p[3] = (byte)(length >> 24);
     p[4] = unchecked((byte)(COMMAND_ID.COMMAND_REG));
     p[5] = (byte)((UInt16)COMMAND_ID.COMMAND_REG >> 8);
     p[6] = (byte)(AppID);
     p[7] = (byte)(AppID >> 8);
     p[8] = (byte)(AppType);
     p[9] = (byte)(AppType >> 8);
     p[10] = (byte)(appnamel );
     p[11] = (byte)(appnamel >> 8);
     p[12] = (byte)(appnamel >> 16);
     p[13] = (byte)(appnamel >> 24);
     appname.CopyTo(p, PacketHeadSize + CommnadSize + AppIDSize + AppTypeSize + StringSize);
     return p;
 }
Exemple #3
0
 internal Client(AppClass App, string ConfigPath)
 {
     this.binPath = ConfigPath;
     this.app = App;
     XmlDocument doc = new XmlDocument();
     doc.Load(binPath + "Config.xml");
     XmlNodeList nodes = doc.GetElementsByTagName("Connect");
     connectcount = Convert.ToInt32(nodes[0].Attributes.GetNamedItem("count").InnerText);
     XmlNodeList nodes2 = doc.GetElementsByTagName("Server");
     localserverid = Convert.ToUInt16(nodes2[0].Attributes.GetNamedItem("id").InnerText);
     ini();
 }
        internal Client(AppClass App, string ConfigPath)
        {
            this.binPath = ConfigPath;
            this.app     = App;
            XmlDocument doc = new XmlDocument();

            doc.Load(binPath + "Config.xml");
            XmlNodeList nodes = doc.GetElementsByTagName("Connect");

            connectcount = Convert.ToInt32(nodes[0].Attributes.GetNamedItem("count").InnerText);
            XmlNodeList nodes2 = doc.GetElementsByTagName("Server");

            localserverid = Convert.ToUInt16(nodes2[0].Attributes.GetNamedItem("id").InnerText);
            ini();
        }
 internal ClientP2P(AppClass App, string ConfigPath)
     : base(App,ConfigPath)
 {
 }
Exemple #6
0
 internal ClientApp(AppClass App, string ConfigPath)
     : base(App, ConfigPath)
 {
 }
Exemple #7
0
 internal ClientMoniter(AppClass App, string ConfigPath)
     : base(App,ConfigPath)
 {
 }
 internal ClientAuthor(AppClass App, string ConfigPath)
     : base(App,ConfigPath)
 {
 }