Solved

Finding User's IP Address.

Posted on 1998-07-29
3
175 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
3 Comments
 
LVL 5

Expert Comment

by:msmolyak
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now