예제 #1
0
        static void Main(string[] args)
        {
            ServerControl serverControl = new ServerControl();

            serverControl.Start();
            Console.ReadKey();
        }
예제 #2
0
 public Client(TcpClient client, ServerControl sControl, int serverId)
 {
     id = serverId;
     serverControl = sControl;
     tcpClient = client;
     clientStream = new SslStream(tcpClient.GetStream(), true);
     formatter = new BinaryFormatter();
     listenThread = new Thread(new ThreadStart(handler));
     listenThread.Start();
 }
예제 #3
0
파일: Program.cs 프로젝트: sbchong/Server
        static void Main(string[] args)
        {
            //new ServerControl().Start();
            //return;
            ServerControl server = new ServerControl();

            server.Start();

            Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            int port;

            if (args.Length > 0)
            {
                port = int.Parse(args[0]);
            }
            else
            {
                port = 1157;
            }
            ServerControl serverControl = new ServerControl();

            serverControl.Start(port);
            Console.WriteLine("127.0.0.1:{0} --服务启动成功", port);
            Console.ReadKey();
        }
예제 #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            txtIP_Validating(sender, new CancelEventArgs());
            txtName_Validating(sender, new CancelEventArgs());
            txtPort_Validating(sender, new CancelEventArgs());
            cmbColours_Validating(sender, new CancelEventArgs());

            if (ValidationInput.ValidatedIP && ValidationInput.ValidatedPort)
            {
                if (ValidationInput.ValidatedUserName && ValidationInput.ValidatedColor)
                {
                    _c.IP   = IPAddress.Parse(txtIP.Text);
                    _c.Port = ushort.Parse(txtPort.Text);

                    Hide();
                    ServerControl newControl =
                        new ServerControl(_c,
                                          new Parcel(txtName.Text, DateTime.Now, txtName.Text + " welcomes you to Chat!",
                                                     Color.FromName(cmbColours.SelectedItem.ToString())));
                    newControl.Show();
                }
            }
        }