Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

jpcap class IPAddress help

Posted on 2004-07-31
8
Medium Priority
?
761 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
[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
8 Comments
 
LVL 3

Assisted Solution

by:JohnnyAffa
JohnnyAffa earned 200 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 50 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
Industry Leaders: 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!

 
LVL 7

Accepted Solution

by:
JugglerW earned 750 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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 …
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…
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…
Suggested Courses

721 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