?
Solved

Finding User's IP Address.

Posted on 1998-07-29
3
Medium Priority
?
182 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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 “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

800 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