public void onNewTcpConnection(System.Net.Sockets.TcpClient tcpConn)
 {
     Console.WriteLine("Nouvelle Connection!!");
     ServeurJoueur handler = new ServeurJoueur(connManager);
     conn = new MessageApi.Connection(tcpConn, handler);
     handler.conn = conn;
 }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("HEY HEY HEY");

            testIPAddr();

            test_server_listener serverListener = new test_server_listener("server");
            test_server_listener clientListener = new test_server_listener("client");
            test_server_listener clientListener2 = new test_server_listener("client2");

            ConnectionServer server = new ConnectionServer(50000, serverListener);
            server.start();

            Connection client = new Connection(ConnectionServer.GetLocalIPv4(), 50000, clientListener);

            Connection client2 = new Connection(ConnectionServer.GetLocalIPv4(), 50000, clientListener2);

            Message msg = client.creerMessage(Message.MessageSujet.NotifDebutTour);
            msg.envoyer();

            msg = client.creerMessage(Message.MessageSujet.NotifDebutTour);
            msg.envoyer();

            msg = client.creerMessage(Message.MessageSujet.RequeteRejoindrePartie);
            msg.envoyer();
            msg = msg.getReponse();

            Console.WriteLine("Reponse = " + msg.sujetMsg.ToString());

            msg = serverListener.conn.creerMessage(Message.MessageSujet.NotifMessage);
            ((NotifMessage)msg).message = "hey hey hey";
            msg.envoyer();

            Console.WriteLine(ConnectionServer.GetLocalIPv4().ToString());

            /* Test init messages speciaux */
            client.creerMessage(Message.MessageSujet.NotifPerteCarte);
            client.creerMessage(Message.MessageSujet.NotifColoniePlace);
            client.creerMessage(Message.MessageSujet.NotifRoutePlace);
            client.creerMessage(Message.MessageSujet.NotifVillePlace);
            client.creerMessage(Message.MessageSujet.NotifVoleurDeplace);

            client2.creerMessage(Message.MessageSujet.NotifPerteCarte);
            client2.creerMessage(Message.MessageSujet.NotifColoniePlace);
            client2.creerMessage(Message.MessageSujet.NotifRoutePlace);
            client2.creerMessage(Message.MessageSujet.NotifVillePlace);
            client2.creerMessage(Message.MessageSujet.NotifVoleurDeplace);

            Console.WriteLine("Aucune exception!");

            client.close();
            client2.close();

            Console.ReadLine();
        }
Example #3
0
 public Message(MessageSujet sujet, Connection source, int id, bool enReception)
 {
     this.sujetMsg = sujet;
     this.connSource = source;
     this.typeMsg = MessageSujetToMessageType(sujetMsg);
     this.repondu = false;
     this.id = id;
     this.estEnvoyer = false;
     this.enReception = enReception;
     this.reponse = null;
 }
 public NotifMessage(MessageSujet sujet, Connection source, int id, bool enReception)
     : base(sujet, source, id, enReception)
 {
 }
 public ReponseRes(MessageSujet sujet, Connection source, int id, bool enReception)
     : base(sujet, source, id, enReception)
 {
 }
 public RequeteRejoindrePartie(MessageSujet sujet, Connection source, int id, bool enReception)
     : base(sujet, source, id, enReception)
 {
 }
 public void onNewTcpConnection(System.Net.Sockets.TcpClient tcpConn)
 {
     Console.WriteLine("Nouvelle Connection!!");
     conn = new MessageApi.Connection(tcpConn, this);
 }
 public TourControlleur(Board board, Connection conn)
 {
     this.board = board;
     this.conn = conn;
 }
 public RequeteVoleur(MessageSujet sujet, Connection source, int id, bool enReception)
     : base(sujet, source, id, enReception)
 {
 }
 public ConstructionControleur(Board board, Connection conn)
 {
     this.board = board;
     this.conn = conn;
 }
Example #11
0
 public void setAsReceived(Connection conn)
 {
     repondu = false;
     estEnvoyer = false;
     enReception = true;
     connSource = conn;
     reponse = null;
 }