java制作的C/S程序
源代码在线查看: csclient.java
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();
}
}