Problem with a UDP server implements

Bernd Petrovitsch bernd at petrovitsch.priv.at
Tue Oct 18 05:20:12 EDT 2011


On Die, 2011-10-18 at 07:26 +0800, tao jiang wrote:
[....]
> Is it to create a SOCK_RAW socket for receieve and send?

Only for sending. Search for sourcecode for `ping` - there are
several around that show how to do it.

You can use recvfrom() to get the senders address for each packet.

[...]
> Will it cause performance problem, compare to SOCK_DGRAM?

IMHO that won't measurably - either user-space constructs the UDP and IP
header or the kernel does. And we talk about a few bytes only.

[ Don't top-post. ]

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at




More information about the Kernelnewbies mailing list