public SocketClient(string IpAddress, Int32 PortNo)
        {
            Ipadressport      = IpAddress + ":" + PortNo;
            this.ipendpoint   = new IPEndPoint(IPAddress.Parse(IpAddress), PortNo);
            this.clientthread = new Thread(new ThreadStart(ClientThread));
            this.clientthread.IsBackground = true;

            this.LogFolder = GlobalValue.LogPath + "\\CPORT" + PortNo + "\\";
            GlobalValue.CreateFolder(this.LogFolder);
            this.LogFile = LogFolder + DateTime.Today.ToString("yyyyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo) + DateTime.Now.ToString("HHmmss", System.Globalization.DateTimeFormatInfo.InvariantInfo) + ".TXT";



            clientthread.Start();
            ;
        }
示例#2
0
        public Boolean initport(int port)
        {
            checkport(port);
            if (!portinuse)
            {
                this.listener1 = new TcpListener(IPAddress.Any, port);

                this.listenserthread1 = new Thread(new ThreadStart(openport));
                this.listenserthread1.IsBackground = true;

                this.LogFolder = GlobalValue.LogPath + "\\SPORT" + port + "\\";
                GlobalValue.CreateFolder(this.LogFolder);
                this.LogFile = LogFolder + DateTime.Today.ToString("yyyyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo) + DateTime.Now.ToString("HHmmss", System.Globalization.DateTimeFormatInfo.InvariantInfo) + ".TXT";



                listenserthread1.Start();
            }
            return(true);
        }