Package reseau

Examples of reseau.CanalTCP


       
        // Création du canal de mise à jour et attente de la connexion
        log("Création du canal de synchronisation");
       
        // Création du canal
        canal_update = new CanalTCP(port);
   
        log("Canal crée");
       
        // envoie de l'etat de la partie
        envoyerSurCanalMAJ(Protocole.construireMsgJoueursEtat(serveur.getJoueurs()));
View Full Code Here


     */
    public boolean enregistrerSurSE(String nomServeur, int nbJoueurs, String nomTerrain, int mode)
    {
        try
        {
            canalServeurEnregistrement = new CanalTCP(Configuration.getIpSE(),
                                                      Configuration.getPortSE());
           
            // Création de la requete d'enregistrement
            String requete = RequeteEnregistrement.getRequeteEnregistrer(
                    nomServeur, Configuration.getPortSJ(), nbJoueurs, nomTerrain, ModeDeJeu.getNomMode(mode));
View Full Code Here

  public void etablirConnexion(String IP, int port)
      throws ConnectException, CanalException, AucunEmplacementDisponibleException
    {
      
      // création du canal 1 (Requête / réponse)
        canalEnvoi = new CanalTCP(IP, port);
       
        // demande de connexion au serveur (canal 1)
        canalEnvoi.envoyerString(jeu.getJoueurPrincipal().getPseudo());
       
        // le serveur nous retourne notre identificateur
        JSONObject msg;
       
        try{
            msg = new JSONObject(canalEnvoi.recevoirString());
            receptionJoueurInitialisation(msg);
        }
        catch (JSONException e1){
            e1.printStackTrace();
        }
       
        // reception de la version du serveur
        String version = canalEnvoi.recevoirString();
        log("Version du jeu : "+version);
       
        // reception du port du canal 2
        int portCanal2 = canalEnvoi.recevoirInt();
       
        // création du canal 2 (Reception asynchrone)
        canalEcoute = new CanalTCP(IP, portCanal2);

        // lancement de la tache d'écoute du canal 2
        (new Thread(this)).start();
    }
View Full Code Here

TOP

Related Classes of reseau.CanalTCP

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.