ServerTest.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package test;
  2. import java.net.UnknownHostException;
  3. import java.util.ArrayList;
  4. import rsx.BomberStudentClient;
  5. import rsx.BomberStudentReponse;
  6. import rsx.tcp.TcpClient;
  7. /**
  8. * Exemple appel vers le serveur
  9. * @author Arthur Brandao
  10. */
  11. public class ServerTest {
  12. /**
  13. * @param args the command line arguments
  14. */
  15. public static void main(String[] args) throws UnknownHostException {
  16. /*
  17. Broadcast b = new Broadcast(18426);
  18. System.out.println(b.search("i'm a bomberstudent server"));
  19. System.out.println("Resultat : " + !b.getServers().isEmpty());
  20. //*/
  21. /*
  22. TcpClient cli = new TcpClient("127.0.0.1", 18642);
  23. cli.connect();
  24. cli.send("Bonjour toi le serveur comment que ça va ?");
  25. System.out.println(cli.receive());
  26. cli.close();
  27. //*/
  28. //*
  29. BomberStudentClient bsc = new BomberStudentClient();
  30. int a = bsc.findServer();
  31. System.out.println(a);
  32. if(a == 0){
  33. System.err.println("Aucun serveur");
  34. return;
  35. }
  36. bsc.selectServer(0);
  37. bsc.send("POST", "aze/rty");
  38. BomberStudentReponse bsr = bsc.receive();
  39. //*/
  40. }
  41. }