• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help: Client Computer Name in Servlet

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27876
197
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic