编辑代码

package pp;

import java.io.*;
import java.net.Socket;

public class TCPmluticlient {
	public static void main(String[] args) throws Exception{
		Socket sk=new Socket("127.0.0.1",9999); 
	       BufferedReader buf = null;  
	        buf = new BufferedReader(
	                new InputStreamReader(
	                        sk.getInputStream()                )
	        		);
	        String str = buf.readLine();  
		
		InputStream ips=sk.getInputStream();
		byte[] by=new byte[1024];
		int len;
		while((len=ips.read(by))!=-1)
	        System.out.println("the server is outputting:"+new String(by,0,len));
	        sk.close();                                        //閸忔娊妫碨ocket
	        buf.close();                                            //閸忔娊妫存潏鎾冲弳濞达拷
	    }

	}