System.out.println("socket=:" +socket);
BufferedReader in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
out.println("hello,server,i am "+clientname);
String str=in.readLine();
System.out.println(str);System.out.print & out.print
out.println("byebye");
在最后两行有system.out.print和out.print.
现在搞不懂两者的区别,请高手指导。
------解决方案--------------------
...out.print是给客户端或者服务端传送数据!《输出流》
syso是在当前控制台打印出信息!
------解决方案--------------------
system.out.print是控制台打印,让你看看实际传的是什么
out.println("byebye");里的out是在上边定义的
PrintWriter out对象,所以out.println才是真正往外发数据system.out.print是不会往外发送数据的