Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
jim chou
Greenhorn
Posts: 4
  • 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: 9406
12
Linux Mac OS X Windows
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!