• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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: 28483
210
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
 
it's a teeny, tiny, wafer thin ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic