Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void creationServeur() throws IOException{
- System.out.println("Je vais cree le serveur");
- FeuillePersoMJ.serveurFJ1 = new ServerSocket(1601, 10); // Creation ServeurSocket pour les échanges d'Object FichePerso 1
- }
- public static void envoisIdentite() throws IOException{
- int portSocketServeurFJ1 = 1601; // Création d'un numéro de port pour les ServeurSocket
- int compteur = 0;
- System.out.println("SERVEUR CREE, MAINTENANT JATTENDS UNE CONNEXION");
- Socket clientFJ1 = serveurFJ1.accept(); // Attente d'une connection avec la socket
- System.out.println("JAI TROUVER UN CLIENT");
- OutputStream socketOut = clientFJ1.getOutputStream(); // Ouverture d'un flux de sortie
- identiteJoueur1 = new ObjectOutputStream(socketOut); //Le flux de sortie est maintenant déterminé pour les Object
- identiteJoueur1.writeObject(identiteJ1); // Sérialisation de(s) object reçu
- identiteJoueur1.flush(); // Vidage mémoire tampon de l'object
- System.out.println("Jai flush");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement