Problem with a UDP server implements

tao jiang jiangtao.jit at gmail.com
Sat Oct 15 05:50:11 EDT 2011


michi:

Thanks for your help.
Much appreciated.



2011/10/15  <michi1 at michaelblizek.twilightparadox.com>:
> Hi!
>
> On 16:29 Sat 15 Oct     , tao jiang wrote:
>> michi:
>>
>> 1.
>> Is that to create two sockets
>> and one bind to 10.0.0.1 the other bind to 10.0.0.2
>> then use epoll wait these two sockets ?
>
> Yes, exactly.
>
>> 2.
>> Is there any way to find out the turple like TCP
>> then the UDP server can reply with exactly the ip it recieved the
>> client's request ?
>
> You should receive the packet only on the socket which is bound to the
> address. You can save the bind address somewhere, so you know the local
> address. You will know the client address because it is passed back by
> recvfrom.
>
>        -Michi
> --
> programing a layer 3+4 network protocol for mesh networks
> see http://michaelblizek.twilightparadox.com
>



More information about the Kernelnewbies mailing list