如何在Windows CE上获取UDP的目标。 [英] How to get the the destination of UDP on Windows CE.
问题描述
大家好。
有人能告诉我如何获取UDP包的目的地。这可能有点令人困惑。
Could someone tell me how to get the destination of a UDP package. It might be a little confusing.
我想知道UDP包是广播(发送到255.255.255.255)还是直接发送给我。
I would like to know whether the UDP package is a broadcast(send to 255.255.255.255) or send to me directly.
    - >在我的申请中,我必须单独处理它们。
--> In my application ,I have to handle them separately.
互联网上有一些东西:
There is something over the internet:
http://stackoverflow.com/questions/5281409/get-destination-address-of-a-received-udp-packet
http://stackoverflow.com/questions/5281409/get-destination-address-of-a-received-udp-packet
我认为: http://social.msdn.microsoft.com/Search/en-US?query = IP_PKTINFO& emptyWatermark = true& ac = 4
And I think : http://social.msdn.microsoft.com/Search/en-US?query=IP_PKTINFO&emptyWatermark=true&ac=4
int getsockopt(
(SOCKET) s, // descriptor identifying a socket
(int) IPPROTO_IP, // level
(int) IP_PKTINFO, // optname
(char *) optval, // output buffer,
(int) optlen, // size of output buffer
);
可以提供帮助。
但这些功能仅适用于桌面平台。
But these features are only available on desktop platform.
有人可以告诉我如何在Windows CE上执行此操作。
Could someone tell me how to do this on Windows CE.
谢谢:)
推荐答案
recvfrom API不提供任何有关发件人地址。您无法区分广播,单播或单播发送。
The recvfrom API doesn't provide any information of the sender address. You can't distinguish between broadcast, unicast or unicast sends.
如果要获取此信息,则需要使用原始套接字。这些在Windows CE 5.0中不可用。有一个
NDIS用户模式/ IO驱动程序,可以是添加到Windows CE Platform Builder中的OS Design。
When you want to get this information you need to use raw sockets. These are not available in Windows CE 5.0. There is a NDIS User-Mode /IO Driver, that can be added to the OS Design in Windows CE Platform Builder.
但Windows Embedded Compact中可能存在原始套接字支持。我目前没有这些信息。
But there might be raw socket support in Windows Embedded Compact. I currently don't have this information.
这篇关于如何在Windows CE上获取UDP的目标。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!