On Jan 28, 4:52 am, szybki <andrzej.dajnow...@gmail.comwrote:
On Jan 28, 8:17 am, Lars Uffmann <a...@nurfuerspam.dewrote:
babakan...@yahoo.com wrote:
How can I read IP Datagram? Should I write some Driver for that? Is
there any special book about it?
Thank you.
I think your best bet is the sockets library. On Linux that's (as far as
I got around to use it) the same interface as winsock on Windows Systems.
Some links that may help you:
C++ Socket library tutorial:http://www.alhem.net/Sockets/tutorial/using.html
Beej's Guide to Network Programming:http://beej.us/guide/bgnet/output/ht...age/index.html
Best Regards,
Lars
You guys talk about using transport layer mechanisms (TCP/UDP), but
babakan asked about IP (network layer) datagrams. A far as I know it
is impossible to access IP layer datagrams with socket mechanisms
directly. Not that I know how to do it other way:)
Raw sockets send/recv at the ip layer. You can also use a datalink
socket to read all ip packets of a particular (or all) interfaces.
Linux native sockets api is written in C. There are a lot of C++
adapters out there on the web as earlier posts mentioned. If you are
interested in IP layer packets you need an implementation that
supports raw sockets. If you are using a particular transport layer
(tcp,udp) you'll need to create a raw socket and use the ip_hdrincl,
you will probably have difficulties setting up a tcp socket this way,
unless you have a stack that does the sequencing for you, but for udp
it fairly trivial.