Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

How to get IP address using jpcap?

Thread view: 
yikaikai - 21 Mar 2007 03:00 GMT
I got the code from
http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html

but how can I get IP address from packet?

public void receivePacket(Packet packet) {
        System.out.println(packet);
Gordon Beaton - 21 Mar 2007 08:48 GMT
> I got the code from
> http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html
[quoted text clipped - 3 lines]
>  public void receivePacket(Packet packet) {
>         System.out.println(packet);

After skimming the javadocs, I'd say you need to do something like
this:

 if (packet instanceOf IPPacket) {
   IPPacket ipp = (IPPacket)packet;
   InetAddress dest = ipp.dest_ip;
   InetAddress src = ipp.src_ip;
 }

/gordon

Signature

[ don't email me support questions or followups ]
g o r d o n  +  n e w s  @  b a l d e r 1 3 . s e

yikaikai - 21 Mar 2007 09:33 GMT
Thank you, I got it.
"Gordon Beaton" <n.o.t@for.email> дÈëÏûÏ¢ÐÂÎÅ:4600e366$0$24617$8404b019@news.wineasy.se...
>> I got the code from
>> http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html
[quoted text clipped - 14 lines]
>
> /gordon


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.