Answer the question
In order to leave comments, you need to log in
How to read bytes from a socket into a buffer in java and then display it on the screen?
My code:
Socket s = new Socket(host, Integer.parseInt(port));
PrintWriter out = new PrintWriter(s.getOutputStream(),true);
BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
out.println("tyda");
char[] buff = new char[1024];
in.read(buff,0,buff.length);
System.out.println(buff);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question