Linux pakets programming

Posted on 2003-03-28
Medium Priority
Last Modified: 2010-04-20
First, i d like to say hi to the staff,
and thank every expert who share their knowledge with us!

I just registered and i already have a question lol

I m not a newbie in C but when it comes to packets programming...i m lost!
I d like to create a tool (in C) that can send custom packets through the net..
But i need someone to show me some code with little comments if possible.
I ve seen many sources about packets but i need explainations,or a good old faq!

That would help ! thanks.
Question by:onimenokyo
  • 2

Expert Comment

ID: 8228894
i assume you mean sockets/ip. If you know perl, its easier to  
 do sockets programming. Otherwise,
man socket + man the "See Also's"

of course, google:
   linux socket tutorial

which  found the following, from this forum:

 garboua 08/14/2002 08:23AM PST

tutorial with excellent examples and tips
or go to www.piratehaven.org and check em OUT.

Author Comment

ID: 8230155

Ok thanx but i ll be more accurate in my question :

I already know sys/socket but i need a simple example about netinet/ip_icmp, ip__udp and netdb.
I ve learned what IHL,TOS,ID,DF... are but i couldn t find out how to declare them.(i ve tryed to explore the "hping" sources but it s not that simple! lol)
I know a bit of perl since it s quite close to C, so should i code my net-tools with it?

The one who can find me a good link or post a little example gets the points!

Accepted Solution

keramati_h earned 225 total points
ID: 8230262
for your purpose, see man page of socket under SOCK_RAW flag.
Or see packet man page. It is a good tutorial for working with packets in OSI layer 2 and above

Enjoy it

Author Comment

ID: 8231349
yah i ve found many useful tips using "sock_raw flag" as a keyword in my search.
I ve also read the packet and socket man pages and i just finished my first packet_maker
coded in C.

Thank u all.
(the points are for keramati_h)
humm...(packet_maker + ethereal = surprise! lol)

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

621 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