套接字编程客户端名称(Socket programming client name)

编程入门 行业动态 更新时间:2024-10-23 08:25:17
套接字编程客户端名称(Socket programming client name)

在“接受”连接之前,有没有办法在服务器端获取客户端名称? 用java。

我是java的新手。

提前致谢..

Is there any way to get client name at the server side before "accepting" the connection? Using java.

I am new to java.

thanks in advance..

最满意答案

在“接受”连接之前,有没有办法在服务器端获取客户端名称?

不 - 您必须先接受连接。 然后,您可以阅读主持人的姓名并选择下一步行动。

Socket client = server.accept(); String hostName = client.getInetAddress().getHostName();

Is there any way to get client name at the server side before "accepting" the connection?

No - you must accept the connection first. Then you may read the host's name and choose the next course of action.

Socket client = server.accept(); String hostName = client.getInetAddress().getHostName();

更多推荐

本文发布于:2023-07-08 20:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1080278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户端   名称   Socket   programming   client

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!