• Post Reply Bookmark Topic Watch Topic
  • New Topic

Workstation Client Name

 
David Garratt
Ranch Hand
Posts: 213
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would very much like some advice on the best way to get the users true computer name. I have an application which needs to determine the users pc name. I am currently using :-

clientname = InetAddress.getLocalHost().getHostName().toLowerCase();

to get the name when the application is running on the users local machine. However it is quite possible that the user may be running the application via a remote terminal server session in which case I would NOT want all the users to get the same servers host name.

Any advice appreciated.

Dave
 
Paul Clapham
Sheriff
Posts: 21875
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or they could be running it via SSH, or via FTP's RCMD command... I doubt there is an easy way to find out the ultimate computer where the user is tapping the keyboard.

Can we back up a step and ask you to explain why you need this information?
 
David Garratt
Ranch Hand
Posts: 213
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure,

My client application has been written to work with a number of different databases. As such I have avoided the use of proprietary methods like sequences or stored procedures to generate unique numbers. My specific application only needs to generate a pallet number and it will suffice for each workstation to have it's own range. I intend to have a table containing client worktation names and when a number is required the applciation will read/increment and store the next number against the record correspodning to its client name. This will avoid and possibility however slight that two workstations will get the same number.

Thanks

Dave
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't you have logins and base your sequence numbers on user identities instead of workstation identities?
 
Paul Clapham
Sheriff
Posts: 21875
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed. Or perhaps configure your workstations so that only one user can sign on at a time.
 
Richard Waldicott
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another option is to have this lookup table bound to the MAC address of client machine. You can get this information, but only starting with JDK 1.6
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!