Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. public class MyServer {
  2.  
  3. ServerSocket sSoc;
  4. Socket soc;
  5. ServerThread t;
  6. int porta = 12345;
  7.  
  8. public void main(String Args[]) {
  9. try {
  10.  
  11. sSoc = new ServerSocket(porta);
  12. System.out.println("Server avviato in ascolto sulla porta 12345");
  13. while(true) {
  14. soc = sSoc.accept();
  15. t = new ServerThread(soc);
  16. t.start();
  17. System.out.println("Avviato thread: " + t.getName());
  18.  
  19.  
  20.  
  21. }
  22. }catch(IOException e){
  23. System.out.println(e);
  24. }
  25. }
  26. }
  27.  
  28.  
  29. public class partecipante implements Serializable {
  30.  
  31. final static long serialVersionUID = 1;
  32. String nome;
  33. String cognome;
  34. String cellulare;
  35. String email;
  36. String codiceCorso;
  37. String idOperatore;
  38.  
  39. public partecipante (String n, String co, String ce, String e, String cod, String id) {
  40. this.nome= n;
  41. this.cognome= co;
  42. this.cellulare= ce;
  43. this.email= e;
  44. this.codiceCorso= cod;
  45. this.idOperatore = id;
  46. }
  47. public String getNome() {
  48. return nome;
  49.  
  50. }
  51. public String getCognome() {
  52. return cognome;
  53.  
  54. }
  55. public String getCellulare() {
  56. return cellulare;
  57.  
  58. }
  59. public String getEmail() {
  60. return email;
  61.  
  62. }
  63. public String getCodiceCorso() {
  64. return codiceCorso;
  65.  
  66. }
  67. public String getIdOperatore() {
  68. return idOperatore;
  69. }
  70. }
  71.  
  72.  
  73.  
  74. public class ServerThread extends Thread {
  75. Socket soc;
  76.  
  77. public ServerThread(Socket s) {
  78. soc = s;
  79. }
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement