Пример #1
0
        public client(TcpClient client,TCPServer root,int id)
        {
            this.iD = id;
            this.root = root;
            this.Client = client;
            if(client.Connected)this.remoteEndPoint = Client.Client.RemoteEndPoint;

            if (root.ConsoleStatus) Text.WriteLine("Initializing stream and threads...  ID: "+ID,ConsoleColor.Black,ConsoleColor.Yellow);

            try
            {
                //get stream
                stream = Client.GetStream();
                //start receive
                Threads.New(new Asynch(receive), null);
                if (root.ConsoleStatus) Text.WriteLine("Client initialized! ID: "+ID, ConsoleColor.Black, ConsoleColor.Green);
            }
            catch {if (root.ConsoleStatus) Text.WriteLine("Client initializing failed! Error initializing stream or threads! ID: "+ID, ConsoleColor.Black, ConsoleColor.Green);}
        }
Пример #2
0
 public void Start()
 {
     server = new TCPServer(Port, (UInt32)dataLengh, 0, (UInt32)SleepReceive);
     server.Start();
 }