Re: Problem with a UDP server implements

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

 



Bernd:

Is it to create a SOCK_RAW socket for receieve and send?
Then is it means I have to parse the IP header and options if any?
Will it cause performance problem, compare to SOCK_DGRAM?

Thanks.


2011/10/15 Bernd Petrovitsch <bernd@xxxxxxxxxxxxxxxxxxx>:
> On Sam, 2011-10-15 at 01:51 +0800, jiangtao.jit wrote:
>> Hi:
>>
>> I'm writing a UDP server and meet a problem
>> the UDP server program is run on a box with single card but has multi ip:
>> like    eth0        10.0.0.1
>>         eth0:1     10.0.0.2
>>               eth0:2          11.0.0.1
>>
>> I bind the server socket with INADDR_ANY
>>
>> when a client send a packet to 10.0.0.2(the eth0:1 's ip)
>> the server can recieve the packet and reply, but the client can't recieve the server's response
>> I use wireshark to capture the response packet
>> and found that the server use 10.0.0.1(the eth0 's ip) as saddr in the response packet
>> I expected it to be 10.0.0.2 but it's not
>> my question : is there any way to let the UDP server relpy just use the ip it receieved the request ?
>> It's :
>> when a client send a request to 10.0.0.1(eth0); the server use 10.0.0.1 to response
>> and another client send a request to 10.0.0.2(eth0:1); the server use 10.0.0.2 to response
>
> You can always build the complete raw packet (including the IP header)
> yourself.
>
>        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