コード例 #1
0
        private void QuestionServer()
        {
            try
            {
                AddTextDelegate AddText      = new AddTextDelegate(PrintToChatBox);
                AddLogDelegate  AddLog       = new AddLogDelegate(PrintLog);
                delAddNewClient addNewClient = new delAddNewClient(AddNewClient);

                IPAddress ip   = new IPAddress(0);
                int       port = defaultPort;

                stQuestion.Server = new TcpListener(ip, port);

                stQuestion.Server.Start();

                Invoke(AddText, "서버가 켜졌어용!");
                Invoke(AddLog, "server on");

                while (true)
                {
                    stQuestion.Client = stQuestion.Server.AcceptTcpClient();
                    Invoke(AddLog, "new client");
                    Invoke(addNewClient, lastID++, stQuestion.Client.GetStream());
                }
            }
            catch (Exception e)
            {
            }
        }
コード例 #2
0
		private void QuestionServer()
		{
			try
			{
				AddTextDelegate AddText = new AddTextDelegate(PrintToChatBox);
				AddLogDelegate AddLog = new AddLogDelegate(PrintLog);
				delAddNewClient addNewClient = new delAddNewClient(AddNewClient);

				IPAddress ip = new IPAddress(0);
				int port = defaultPort;

				stQuestion.Server = new TcpListener(ip, port);

				stQuestion.Server.Start();

				Invoke(AddText, "서버가 켜졌어용!");
				Invoke(AddLog, "server on");

				while (true)
				{
					stQuestion.Client = stQuestion.Server.AcceptTcpClient();
					Invoke(AddLog, "new client");
					Invoke(addNewClient, lastID++, stQuestion.Client.GetStream());
				}

			}
			catch (Exception e)
			{
			}
		}