Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to accept a binarydata in net abd change it to string

 
jim chou
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is my code
//client
import java.net.*;
import java.io.*;
public class Client{
public static void main(String args[])throws IOException{
Socket s=new Socket("127.0.0.1",1234);
OutputStream os=s.getOutputStream();
PrintStream out=new PrintStream(os);
out.println("hello");
}
}
import java.net.*;
import java.io.*;
public class server{
public static void main(String args[])throws IOException{
ServerSocket s=new ServerSocket(1234);
Socket ss=s.accept();
InputStream is=ss.getInputStream();
OutputStream os=ss.getOutputStream();
/*what can i do to accept the data from client"hello" and show it in the server.
*/
}
}
thank you very much.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read through the Custom Networking trail of the Java Tutorial. It's full of helpful examples, including reading to and writing from sockets.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic