コード例 #1
0
ファイル: Client.cs プロジェクト: michaelbehner96/Xyzzxyz
 public Client(TcpClient tcpc, Server server)
 {
     this.tcpc = tcpc;
     this.tcpc.ReceiveTimeout = 15000;
     this.tcpc.SendTimeout = 15000;
     this.Reader = new StreamReader(tcpc.GetStream());
     this.Reader.BaseStream.ReadTimeout = 15000;
     this.Writer = new StreamWriter(tcpc.GetStream());
     this.Writer.BaseStream.WriteTimeout = 15000;
     inputThread = new Thread(listenForInput);
     inputThread.Name = "InputThread::" + tcpc.Client.RemoteEndPoint;
     listening = true;
     inputThread.Start();
     this.Server = server;
     OnConnect(this, new ConnectionEventArgs(this));
     Server.OnConnect(this, new ConnectionEventArgs(this));
 }
コード例 #2
0
ファイル: VideoSync.cs プロジェクト: michaelbehner96/Xyzzxyz
        public void StartHosting()
        {
            try
            {
                if (IsHosting)
                {
                    HostedServer.Stop();
                    SyncTimer.Stop();
                }

                HostedServer = new Server(HostPort);
                HostedServer.Start();
                HostedServer.Input += OnHostInput;
                HostedServer.Output += OnHostOutput;
                HostedServer.Connect += OnHostConnect;
                HostedServer.Disconnect += OnHostDisconnect;
                SyncTimer.Start();
            }
            catch (Exception e)
            {
                StopHosting();
                Debug.Log(e);
            }
        }
コード例 #3
0
 private void OnLoad(object sender, EventArgs e)
 {
     Server = new Server(25564);
     Server.Start();
 }