[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Finding User's IP Address.

Posted on 1998-07-29
3
Medium Priority
?
183 Views
Last Modified: 2010-03-30
I'm looking for a complete program (in .class type) that will do the following thing :

Let's say I have a chat, which consists of 10 users at the present. I want to find the IP address of one of the users (not the chat IP, the user IP).

I'm giving a lot of points, because I need it bbbaaaddd.
0
Comment
Question by:yyyannag
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1229017
The function you are looking for, is it internal or external to the chat program. That is are you going to write a chat program in Java and looking for a particular module implementation or you have an existing chat program and want an independent application which determines user's IP addresses?
0
 
LVL 1

Accepted Solution

by:
mbelonga earned 900 total points
ID: 1229018
Depending on your implementation and chat server protocol, the *exact* way you'd go about getting the user's ip address will vary, but in general the answer is relatively simple:

Assuming you're writing a chat server, you will have a java.net.ServerSocket doing a
  server.accept();
somewhere.

accept() returns a java.net.Socket connection to the remote host.

All you would have to do to get the ip address of that remove host is something like this:
  Socket client = server.accept();
  String clientIp = client.getInetAddress().getHostAddress();

And then if you stored these clientIp Strings somewhere with mappings to usernames (such as a Hashtable), you would easily be able to retrieve the ip adress of any particular username.
0
 
LVL 2

Author Comment

by:yyyannag
ID: 1229019
I'm sorry, But I asked for a full program in Java, Since I don't have the slightest idea in Java programming. I'm increasing the points as a good will gesture, And hope I will get my answer soon.

P.S. If you need the address of the chat, it's :

http://chat.iol.co.il/chat/javachat.htm

I want to find the IP number of any user I choose, not the IP number of the srever the chat is working from.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question