Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-05-2004, 01:28 AM   #1
Registered: Jan 2003
Posts: 76

Rep: Reputation: 15
How to read UDP packet payload ?

I meddling with sk_buff and I want to write a code to read the contents of a UDP packet.

I know that sk_buff->data gives the data head pointer. How can I make use of this to read the contents?

Please advise.
Old 11-06-2004, 02:50 PM   #2
LQ Newbie
Registered: Sep 2003
Posts: 6

Rep: Reputation: 0
I don't know sk_buff, but what's wrong with a for loop with a print statement?
Old 02-07-2006, 09:00 PM   #3
Registered: Jan 2005
Location: Pittsburgh
Distribution: Ubuntu
Posts: 378

Rep: Reputation: 30
you will want to do something like:
for(i = 0; i < sk_buff->data_length; i++)
printf("%c", sk_buff->data[i]);

but sk_buff->data_length is probably not the exact variable name, you have to look for the data length in the header, i'm not sure its explicit though, data length might be packet size - header size


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
how do i read the data in the packet that i have captured after packet capture? gajaykrishnan Programming 23 04-19-2006 05:09 AM
How to use skbuff to scan every byte of the payload of an UDP packet? sceadu Programming 0 11-03-2004 09:34 PM
UDP packet oss dazdaz Linux - Networking 2 04-05-2004 01:30 PM
how to include my payload with packet that kernel sends to other pc cranium2004 Linux From Scratch 0 02-23-2004 02:11 AM
UDP: short packet markus1982 Linux - Security 4 08-12-2003 08:03 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:14 PM.

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