aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes IP Address Sniffer Log Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "IP Address Sniffer Log" Watch "IP Address Sniffer Log" New topic
Author

IP Address Sniffer Log

dashang trivedi
Greenhorn

Joined: Mar 01, 2010
Posts: 26
My Objective is to store the IP address of particular machine ...which machine send request to server pc....

for Example
machine A send request to machine B....so machine A should Log the Machine B Ip address....

simple old method for know ip Address of static pc or address...




This Method Is not workingbecause how can i Find the machine ip request....

Please Reply if any solution is their.....
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

Of course that code doesn't do anything useful because it just uses hard-coded addresses.

You didn't say anything about your server, which is where you would be getting these IP addresses from. So it's rather difficult to explain how to get IP addresses from your server. But since you didn't post this in any of the forums related to web applications, let me assume that it isn't a web application. Let me also assume that you have a ServerSocket and are accepting requests from it.

In which case the accept() method returns a Socket. Which has a method to get the address to which that Socket is connected. That's the address you want.

Or if my assumptions were wrong, feel free to provide information.
dashang trivedi
Greenhorn

Joined: Mar 01, 2010
Posts: 26
yes sir....you understand absolutely correct.........
its not any web server...its a simple machine....

Now sir Server scocket is not work here...
if i bind ServerSocket(80)...so its give me an exception...80 is already bind its http port....
so how can i accept...
i try to develop software like wireshark...
initial level i just try how to get ip address of each Request...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

I see; so you don't even have a working server yet. You might want to get your server working first and then add in the simple code to get the addresses of the clients.

By the way, Wireshark isn't a server so you may be on the wrong track. Or perhaps that was just a bad example you chose.
 
 
subject: IP Address Sniffer Log