发布网友 发布时间:2022-04-20 07:06
共2个回答
热心网友 时间:2023-07-04 09:50
Scanner sc = new Scanner(System.in);
String ip = sc.next();
String port = sc.next();
Socket socket = new Socket(ip,port);追问完整的代码
追答Scanner input = new Scanner(System.in);
Socket socket = new Socket("localhost",6000);
ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
//自己创建一个消息对象Message里面根据自己需求封装信息
Message msg = new Message();
out.writeObject(msg);
热心网友 时间:2023-07-04 09:50
啥意思呢 是要连接socket服务器么