Solved

jpcap class IPAddress help

Posted on 2004-07-31
8
743 Views
Last Modified: 2008-02-01
I have started playing around with the jpcap classes for java and I would like to use some stuff I saw in the IPAddress package(setAddressConvert(boolean isDomainName), getHostName(), getHostAddress(), toString() )
 and was wondering if anyone new of a site where I could get more info on how to use them or if anyone could post some sample code would be great. I looked through the api manual, but I like to see examples.

Thank you to all
0
Comment
Question by:heydude
8 Comments
 
LVL 3

Assisted Solution

by:JohnnyAffa
JohnnyAffa earned 100 total points
ID: 11687137
am not familiar with jpcap package or IPAddress class, but have you looked at InetAddress class in java.net package?.....sound like is something similar to what you want.

what sort of info are you after? (be specific)
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 25 total points
ID: 11687561
0
 

Author Comment

by:heydude
ID: 11687675
I had already looked through the API Manual at the from the link listed by mayankeagle and it doesn't tell me much. I like to see examples. I haven't looked at the InetAddress, I was looking at the packet capturing side and wanted to use jpcap because it does that. I don't think the InetAddress class would handle that.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 7

Accepted Solution

by:
JugglerW earned 375 total points
ID: 11688989
You've seen this example? Is from the same site as the link above.
To get it work you need libcap from: http://www.tcpdump.org/


import jpcap.*;

class Tcpdump implements JpcapHandler
{
   public void handlePacket(Packet packet){
     System.out.println(packet);
   }
 
   public static void main(String[] args) throws java.io.IOException{
     String[] lists=Jpcap.getDeviceDescription();
     System.out.println("Start capturing on "+lists[0]);

     Jpcap jpcap=Jpcap.openDevice(Jpcap.getDeviceList()[0],1000,false,20);
     jpcap.loopPacket(-1,new Tcpdump());
   }
}

Another link I've found:

http://jpcap.sourceforge.net/

0
 

Author Comment

by:heydude
ID: 11689041
setAddressConvert(boolean isDomainName), getHostName(), getHostAddress(), toString() )

I've seen it and ranit and it doesn't tell me anything about the items that I am looking for. I also found the visual JpcapDumper, but I can't figure out how it displays the destination host name and source hostname. That's really what I am looking for is how to capture packets witht he jpcap package and display the destination ip and url. So if I went to say the experts exchange website I would see(this is not the real ip of the expert's exchange)
68.45.98.109 www.experts-exchange.com the tcpdump program shows how to capture packets, but nothing more. I wish they would have more examples listed.
0
 
LVL 7

Expert Comment

by:JugglerW
ID: 11689047
0
 

Author Comment

by:heydude
ID: 11689144
I am looking for samples, examples, etc.. that pertain to the following post I had submitted:

I've seen it and ran it(tcpdump) and it doesn't tell me anything about the items that I am looking for. I also found the visual JpcapDumper, but I can't figure out how it displays the destination host name and source hostname. That's really what I am looking for is how to capture packets with the jpcap package and display the destination ip and url. So if I went to say the experts exchange website I would see(this is not the real ip of the expert's exchange website)
68.45.98.109 www.experts-exchange.com the tcpdump program shows how to capture packets, but nothing more. I wish they would have more examples listed.
0
 

Author Comment

by:heydude
ID: 11706889
I'm giving up on this question and will research myself. I'm giving some point's to JugglerW  for the sourceforge link. I had already been their, but I found a new link the second time around. Everything else was stuf I already was aware of.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
more than one jdk and one jre 1 50
How to convert String matching to regex in java 4 48
login form jsp example 2 35
Java 8 to Java 6 8 20
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

807 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