package day12.demo8;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
public class TCPClient {
public static void main(String[] args) throws IOException {
Socket socket = new Socket("192.168.22.54",8002);
InputStream in = socket.getInputStream();
byte[] buffer = new byte[1024];
int len = in.read(buffer);
System.out.println(new String(buffer,0,len));
in.close();
socket.close();
}
}
|
|