csclient.java

来自「java制作的C/S程序」· Java 代码 · 共 32 行

JAVA
32
字号
import java.io.*;
import java.net.*;
public class CSClient extends Thread
{
	String hostIp="192.168.18.2";
	int port=8888;
	Socket socket=null;
	public CSClient()
	{
	}
	public CSClient(String hostIP,int port)
	{
		try
		{
			this.hostIp=hostIP;
			this.port=port;
			socket=new Socket(hostIP,port);
			UserThread userThread= new UserThread(socket);
			userThread.start();
		}
		catch(Exception e)
		{
			System.out.println(e.toString());
		}
	}
	public static void main(String[] args)
	{
		CSClient client=new CSClient("192.168.18.2",6666);
		client.start();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?