a
This commit is contained in:
1 parent
2c81527bf0
commit
142fce31c0
2 files changed
+2
-2
No files matched your search
@@ -31,7 +31,7 @@ public class Client {
|
||||
// 主方法
|
||||
public static void main(String[] args) throws Exception, IOException {
|
||||
String ip = "127.0.0.1"; // 服务器IP
|
||||
int port = 1234; // 服务器程序的端口
|
||||
int port = 9999; // 服务器程序的端口
|
||||
// 1.建立与服务器的连接
|
||||
socket = new Socket(ip, port);
|
||||
// 获取输入流
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Server {
|
||||
// 创建服务器
|
||||
int port = 9999;
|
||||
ServerSocket server = new ServerSocket(port);
|
||||
System.out.println("服务器正在1234端口侦听客户端请求");
|
||||
System.out.println("服务器正在 9999 端口侦听客户端请求");
|
||||
// 循环等待客户端请求
|
||||
while (true) {
|
||||
Socket socket = server.accept();
|
||||
|
||||
Reference in new issue
Block a user