package Lovejia.TestClient;
import java.io.*;
import java.net.*;
public class TestClient
{
Socket socket;
BufferedReader in;
PrintWriter out;
public TestClient()
{
try
{
while(true)
{
socket = new Socket("127.0.0.1", 9527);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(),true);
BufferedReader line = new BufferedReader(new InputStreamReader(System.in));
out.println(line.readLine());
line.close();
out.close();
in.close();
socket.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
System.out.println("Client Start!");
new TestClient();
System.out.println("Client Over!");
}
}
代码整理——testClient
最新推荐文章于 2024-03-18 14:36:41 发布