import java.io.*;
import java.net.*;
public class Client {
public static void main(String[] args) throws IOException {
String serverAddress = "localhost";
int port = 8888;
Socket socket = new Socket(serverAddress, port);
System.out.println("已连接到服务器:" + serverAddress);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
out.println("Hello, Server!");
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String response = in.readLine();
System.out.println("收到服务器响应:" + response);
socket.close();
}
}