468,512 Members | 1,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

How can I read IP Datagram?

How can I read IP Datagram? Should I write some Driver for that? Is
there any special book about it?
Thank you.
Jan 27 '08 #1
8 3154
ba********@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.
The is off topic and platform specific.

google for "UDP send recv socket select C++" - see what you get.

There are plenty of libraries that you can use - commonc++, austria C++,
ACE, that hide most of the platform dependant stuff.

I don't know of any standardization work for C++ with sockets, although,
that would be very very useful.
Jan 27 '08 #2
On 27 Jan., 23:30, Gianni Mariani <gi4nos...@mariani.wswrote:
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.

The is off topic and platform specific.

google for "UDP send recv socket select C++" - see what you get.

There are plenty of libraries that you can use - commonc++, austria C++,
* ACE, that hide most of the platform dependant stuff.

I don't know of any standardization work for C++ with sockets, although,
that would be very very useful.

Theres boosts asio, which I guess is as close as it gets. I do not
know if it supports UDP.

/Peter
Jan 27 '08 #3
ba********@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
Jan 28 '08 #4
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:)
Jan 28 '08 #5
szybki wrote:
You guys talk about using transport layer mechanisms (TCP/UDP), but
babakan asked about IP (network layer) datagrams.
Oops, sorry - forgive my ignorance - only just entered the topic this
year - wasn't aware that sockets was limited to the higher layers.

Thanks for pointing that out & Best Regards,

Lars
Jan 28 '08 #6
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.
Jan 28 '08 #7
On Jan 28, 12:49 pm, Lars Uffmann <a...@nurfuerspam.dewrote:
szybki wrote:
You guys talk about using transport layer mechanisms (TCP/UDP), but
babakan asked about IP (network layer) datagrams.

Oops, sorry - forgive my ignorance - only just entered the topic this
year - wasn't aware that sockets was limited to the higher layers.
Actually the BSD socket interface allows access to the raw packet
data, allowing arbitrary composing all kind of IP packets.
I even think that posix standardized the API. I'm not sure that there
is any C++ api that allows it. I would bet on ACE though.

HTH,

--
gpd
Jan 28 '08 #8
In article <b4fddfe0-f54c-446e-9c48-2ce07842ce69
@z17g2000hsg.googlegroups.com>, an***************@gmail.com says...

[ ... ]
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:)
RTFM for SOCK_RAW.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jan 29 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jonathan Ellis | last post: by
3 posts views Thread by roberto | last post: by
4 posts views Thread by Gregory Hassett | last post: by
6 posts views Thread by Iain King | last post: by
4 posts views Thread by alberto.castellin | last post: by
6 posts views Thread by 7stud | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.