套接字编程客户端名称(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();更多推荐
发布评论