LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-26-2004, 02:08 AM   #1
docterling
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Rep: Reputation: 0
So weird!!!


Code:
souraddr.sin_addr.s_addr=192.168.68.8;sourceport:200
destaddr.sin_addr.s_addr=192.168.68.9;destport:300(Just for example)

when I use:
printf("src:%s: port%d--->dst:%s: port%d",
            inet_ntoa(souraddr.sin_addr),ntohs(tcp->source),
            inet_ntoa(destaddr.sin_addr),ntohs(tcp->dest));
It output like this:
src:192.168.68.8: port200--->dst:192.168.68.8: port200(why the same?)

but when I use:
printf("src:%s: port%d--->",
           inet_ntoa(souraddr.sin_addr),ntohs(tcp->source));
printf("dst:%s: port%d ",
           inet_ntoa(destaddr.sin_addr),ntohs(tcp->dest));
It output like this:
src:192.168.68.8: port200--->dst:192.168.68.9: port300(It's right!!!)
got any ideas???

and how can I catch the time when I capture the packet???
Btw,I didn't use libpcap,I use socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)),the packet it capture contain no timestamp,how should I do?

Last edited by docterling; 05-26-2004 at 09:26 AM.
 
Old 05-26-2004, 09:27 AM   #2
docterling
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Original Poster
Rep: Reputation: 0
no one know?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
weird, weird problems with logitech precision USB gamepad ikataii Linux - Hardware 4 10-14-2005 05:31 AM
Weird Wish :D ekinox Linux - Networking 1 04-12-2005 01:30 PM
HP Photosmart weird weird weird.... Vlad_M Linux - General 5 02-20-2005 06:41 AM
Weird, weird apache2 problem atheist Debian 1 09-17-2004 09:26 PM
Weird Bigun Linux - Software 2 09-22-2002 03:04 AM


All times are GMT -5. The time now is 09:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration