fork download
  1. package ist.ass2;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.DataInputStream;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.io.PrintStream;
  8. import java.net.Socket;
  9. import java.net.UnknownHostException;
  10.  
  11.  
  12. public class NCBClient implements Runnable{
  13.  
  14. private static Socket socket = null;
  15. private static PrintStream os = null;
  16. private static DataInputStream is = null;
  17.  
  18. private static BufferedReader inputLine = null;
  19. private static boolean closed = false;
  20.  
  21. private static final int PORT = 6565;
  22. private static final String HOST = "localhost";
  23.  
  24. public void main(String[] args){
  25. try {
  26. socket = new Socket(HOST, PORT);
  27. inputLine = new BufferedReader(new InputStreamReader(System.in));
  28. os = new PrintStream(socket.getOutputStream());
  29. is = new DataInputStream(socket.getInputStream());
  30. } catch (UnknownHostException e) {
  31. e.printStackTrace();
  32. } catch (IOException e) {
  33. e.printStackTrace();
  34. }
  35.  
  36. try{
  37. new Thread(new NCBClient()).start();
  38. while(!closed){
  39. os.println(inputLine.readLine());
  40. }
  41. os.close();
  42. is.close();
  43. socket.close();
  44. } catch(IOException e){
  45. e.printStackTrace();
  46. }
  47. }
  48.  
  49. public void run() {
  50. //noch unklar
  51. }
  52.  
  53.  
  54. }
  55.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: class NCBClient is public, should be declared in a file named NCBClient.java
public class NCBClient implements Runnable{
       ^
1 error
stdout
Standard output is empty