コード例 #1
0
        /// <summary>
        /// 开始监听指定用户的信息
        /// </summary>
        public void reciveMessageBegin(User user)
        {
            MessageReciver reciver = new MessageReciver(user);

            user.Thread = new Thread(reciver.begin);
            user.Thread.Start();
        }
コード例 #2
0
ファイル: Petrum.cs プロジェクト: BenjaminCoupry/Petrum
 public Petrum(bool Host, int Port, string IP = null)
 {
     InitializeComponent();
     Path         = System.Environment.CurrentDirectory;
     chargementOK = true;
     try
     {
         bpLapin = (Bitmap)Bitmap.FromFile(Path + "/Lapin.bmp");
         bpHerbe = (Bitmap)Bitmap.FromFile(Path + "/Herbe.bmp");
         bpLoup  = (Bitmap)Bitmap.FromFile(Path + "/Loup.bmp");
     }
     catch (Exception e)
     {
         MessageBox.Show("Textures Introuvables " + e.Message);
         chargementOK = false;
     }
     this.Resize                    += Petrum_Resize;
     this.KeyDown                   += MainWindow_KeyDown;
     MessageReciver.DoWork          += MessageReciver_DoWork;
     CheckForIllegalCrossThreadCalls = false;
     Plat = new Plateau(herbeInit);
     Maj();
     if (Host)
     {
         Joueur  = 0;
         Serveur = new TcpListener(System.Net.IPAddress.Any, Port);
         Serveur.Start();
         UnfreezePlateau();
         Sock = Serveur.AcceptSocket();
     }
     else
     {
         Joueur = 1;
         try
         {
             Client = new TcpClient(IP, Port);
             Sock   = Client.Client;
             MessageReciver.RunWorkerAsync();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             Close();
         }
     }
 }
コード例 #3
0
ファイル: Server.cs プロジェクト: HotFlow/ConsolePlusLib
 /// <summary>
 /// 开始监听指定用户的信息
 /// </summary>
 public void reciveMessageBegin(User user)
 {
     MessageReciver reciver = new MessageReciver(user);
     user.Thread = new Thread(reciver.begin);
     user.Thread.Start();
 }