예제 #1
0
        public Server(Plateforme laPlateforme, string lAdresseS, int lePortS, int laCapacite = 6)
        {
            this.laPlateforme = laPlateforme;
            this.lePortS      = lePortS;
            this.laCapacite   = laCapacite;
            leSocket          = new Socket(AddressFamily.InterNetwork,
                                           SocketType.Stream,
                                           ProtocolType.Tcp);
            IPEndPoint iep = new IPEndPoint(IPAddress.Parse("0.0.0.0"), this.lePortS);

            leSocket.Bind(iep);
            leSocket.Listen(1);
        }
예제 #2
0
 //Constructeur A partir de la plateforme
 public Client(string adresseS, int port, string adresseC, int num = 0, Plateforme laPlateforme = null)
 {
     this.numero       = num;
     this.lAdresseS    = adresseS;
     this.lAdresseC    = adresseC;
     this.lePortS      = port;
     this.laPlateforme = laPlateforme;
     this.leSocket     = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     this.leIPEP       = new IPEndPoint(IPAddress.Parse(adresseS), port);
     this.leSocket.Connect(leIPEP);
     leNS = new NetworkStream(this.leSocket);
     leTR = new StreamReader(this.leNS);
     leTW = new StreamWriter(this.leNS);
 }
예제 #3
0
 //Constructeur pour la création du joueur provenant du client.
 public Joueur(string login, string lAdresseS, int lePortS, string lAdresseC, int num, Plateforme laPlateforme) : base(lAdresseS, lePortS, lAdresseC, num, laPlateforme)
 {
     this.numero  = num;
     this.leLogin = login;
 }