LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-01-2005, 07:57 AM   #1
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 50
Send packets manually


I am starting to get the hang of creating connections in c using socket(), bind(), listen(), accept() and so on. Both as a server and as a client, send()ing data or recv()ing data.

But now I want to send packets manually, meaning that I want to send for example a TCP SYN packet and then wait for a SYN/ACK, and so on. Doing everything myself. Is there any good guides on how to do this out there?

Of course I want to do it in c-code.
 
Old 04-01-2005, 08:45 AM   #2
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
Not sure if this is helpful or not, but I think the whole point of TCP is that you can abstract away the notion of packets and just deal with streams (with guaranteed delivery no less ). If you want to toss that abstraction, there's always UDP (one of the only things UDP packets add to IP datagrams is the notion of port numbers).

Let us know what you end up finding.
 
Old 04-01-2005, 09:24 AM   #3
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
not sure what you are up to
anyway take a look at these two articles

Linux Raw Socket Programming - What Lies Beneath a Socket? Part 1

Linux Raw Socket Programming - What Lies Beneath a Socket? Part 2
 
Old 04-02-2005, 03:16 AM   #4
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Original Poster
Rep: Reputation: 50
Hehe, don't know what I am up to? Well I am reading this book on TCP/IP and now I find it dull that I just need to do some system calls and I have a connection. I want to see and send all those packets by myself, setting the ACK-flag manually along with the destination IP and then send it out to cyberspace. I am trying to learn about how TCP/IP works and I want to be able to play with it as I learn.

I will check those two links. See if they are good enough.

EDIT: I have started reading part 1, think I understand now what you ment with "don't know what you're up to".

Last edited by Ephracis; 04-02-2005 at 03:36 AM.
 
Old 04-02-2005, 04:56 AM   #5
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
hehe....don't be naughty....hr........


anyway,not sure whether it works in newer kernel....

Last edited by alred; 04-02-2005 at 04:58 AM.
 
  


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
unable to send packets cranium2004 Linux - Networking 2 02-05-2005 10:28 PM
How do you send packets in ASM? Qwirt Programming 4 11-13-2004 03:11 PM
send packets at network Jamesminh Linux - Networking 0 10-01-2004 02:38 AM
recieve and send IP packets! Farhang Linux - Networking 1 07-25-2004 02:47 PM
update redhat 8.0 rpm packets manually? maxut Red Hat 3 03-19-2004 03:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:25 AM.

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
Open Source Consulting | Domain Registration