Re: Problem with a UDP server implements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bernd:

Thanks for your guide.
But there is still a question
if recvfrom() used, how to figure out the client's dest ip for reply ?
i.e. on which ip the server receieved the request
when construct the IP header, i don't know which saddr to fill in

Thanks.


2011/10/18 Bernd Petrovitsch <bernd@xxxxxxxxxxxxxxxxxxx>:
> 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@xxxxxxxxxxxxxxxxxxx
>                     LUGA : http://www.luga.at
>
>

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux