DatagramSocket event MessageReceived dosen't trigger

怎甘沉沦 提交于 2020-01-17 05:38:08

问题


I have a Console Udp Server based on the System.Net.Sockets UdpClient from which I'm sending Udp Packets to the Ip of my Windows Phone 8.1.

The client on the phone uses Windows.Networking.Sockets DatagramSocket, my problem is that the event MessageReceived dosen't happen.

Source for DatagramSocket:https://msdn.microsoft.com/library/windows/apps/br241319


回答1:


Took me ages to find the solution since it's pretty dumb: The DatagramSocket only starts to receive after it has sent something. (At least for broadcast messages.)

Some code: https://gist.github.com/michaelosthege/857acac92b8ee689a6bb30d5bf23d9f6



来源:https://stackoverflow.com/questions/32254106/datagramsocket-event-messagereceived-dosent-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!