Packets and C?

I am sure you all have heard of the word packet as it related to communication.

How do you exactly put together (in C) a packet of say 10 or 20 or 50 bytes?

How do you send this packet?

I would appreciate a sample. Is there any good tutorial that talks about packets and how to use C to form, send, and receive them?

Regards

Where are you sending the packets? What is the communication medium?

Leon

leon_heller:
Where are you sending the packets? What is the communication medium?

Leon

At this point I am not doing anything. I just want to know.

Suppose you have 10KB of data(let’s say just plain character). How do you breakup this 10 KB?

How do you arrange them into packets of smaller size?

How do you send and receive them?

What I am looking for, is basically a sample C code. Thanks

Look at a typical TCP/IP stack implementation of TCP, there is plenty of code around. UDP is simpler than TCP, and might be easier to understand.

Leon

leon_heller:
Look at a typical TCP/IP stack implementation of TCP, there is plenty of code around. UDP is simpler than TCP, and might be easier to understand.

Leon

Do you have any link where I might be able to get them?

Regards

smdFan:

leon_heller:
Look at a typical TCP/IP stack implementation of TCP, there is plenty of code around. UDP is simpler than TCP, and might be easier to understand.

Leon

Do you have any link where I might be able to get them?

Regards

any book store will have a primer on networking and the Internet Protocols (IP) including TCP

smdFan:

leon_heller:
Look at a typical TCP/IP stack implementation of TCP, there is plenty of code around. UDP is simpler than TCP, and might be easier to understand.

Leon

Do you have any link where I might be able to get them?

Regards

Microchip has source code for a TCP/IP stack. There is also the Ethernut project:

http://www.ethernut.de/

Leon