Solved

Finding User's IP Address.

Posted on 1998-07-29
3
179 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 450 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

737 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