• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help: Client Computer Name in Servlet

 
Shams Pakistan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Hope you are doing fine. We have an internet facing web application which is running on WebSphere. I would like to get the Client Computer Name within one of the Servlets, I believe I can get the IP address using but the IP address would be different each time a user invokes a Servlet. I need to maintain within our database USERID and Computer Name i.e. one USERID can have multiple Computer Names.

I believe I can not get the MAC address within Servlet but I was wondering if it is possible to get client computer name.

I would really appreciate any help

Thanks
Regards
 
harshvardhan ojha
Ranch Hand
Posts: 157
1
Android Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try with
getRemoteHost(), which Returns the host name of the client sending the request. If the name is unknown, returns an empty string.
 
Shams Pakistan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello harshvardhan ojha,

Thank you very much for your prompt reply. What do you mean when by if host is unknown?

Please advise.

Thanks
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't get the MAC address - java or not - unless the source machine is on the same LAN segment as the server, much less off the open Internet. MAC addresses don't get transported across routers.

For a variety of reasons, the source IP addresses and hostnames of client computers is unreliable, when it's available at all.
 
Shams Pakistan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim Holloway,

I am not trying to get the network card MAC address but rather the computer name. So are you saying that request.getRemoteHost() will not return the computer name of the client correctly?

Please advise
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!