You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Client.java 933B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package kommunikation.transmitter;
  7. import java.io.IOException;
  8. import java.io.ObjectInputStream;
  9. import java.io.ObjectOutputStream;
  10. import java.net.Socket;
  11. /**
  12. *
  13. * @author Alexander_Christoph
  14. */
  15. public class Client extends Kommunikationspartner
  16. {
  17. public Client()
  18. {
  19. this.ip = "127.0.0.0";
  20. lg.info("Client erstellt");
  21. }
  22. @Override
  23. public void verbinde()
  24. {
  25. try
  26. {
  27. Socket s = new Socket(ip, port); // Achtung: blockiert!
  28. lg.info("Client: socket erstellt");
  29. out = new ObjectOutputStream(s.getOutputStream());
  30. in = new ObjectInputStream(s.getInputStream());
  31. lg.info("Client: Stream initialisiert");
  32. }
  33. catch (IOException ex)
  34. {
  35. lg.severe(ex.toString());
  36. }
  37. }
  38. }