c# - Problems with UDP in windows 10. UWP -


i having following problem: communicating 2 different machines in local network udp.

in 1 side have windows 7 machine 4.5 framework installed. using class system.net code:

 public static void udpwriter()      {          task.run(async () =>          {              byte[] data = new byte[10000];             ipendpoint ipep = new ipendpoint(ipaddress.pars("192.168.0.16"), 5002);              socket udpclient = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp);               udpclient.connect(ipep);              while (true)              {                 await task.delay(24);                 string input = packagetosend;                 data = encoding.ascii.getbytes(input);                 var receivedresults = udpclient.send(data, socketflags.none);              }          });      } 

in other side working windows 10 universal app code:

   async static private void enablerlistener()         {             //click              hostname hostname = new hostname("192.168.0.16");             listener = new datagramsocket();             listener.control.inboundbuffersizeinbytes=10000;               listener.messagereceived += socket_messagereceived;               await listener.bindservicenameasync("5002");          }         static void socket_messagereceived(datagramsocket sender, datagramsocketmessagereceivedeventargs args)         {              // message received. place logic here          } 

as send "small" package ( theory less mtu) receive correctly sent.

the problem comes udp package fragmented. when send 1 packages splitted in 4 ( have seen in wireshark) windows 10 software not receive anything. have tried changing listener.control.donotfragment( maybe using wrong) seems not working. update1: in wireshark receive message time-to-live exceeded (fragment reassembly time exceeded) packages in wireshark, others succesfully reassembled ( all)

local machine ipc using loopback on uwp restricted. ran in problem myself. perhaps consider different approach app-to-app communication - https://channel9.msdn.com/events/build/2015/3-765

from datagramsocket sample:

note network communications using ip loopback address cannot used interprocess communication between universal windows platform (uwp) app , different process (a different uwp app or desktop app) because restricted network isolation. network communication using ip loopback address allowed within same process communication purposes in uwp app. more information, see how set network capabilities.

https://github.com/microsoft/windows-universal-samples/tree/master/samples/datagramsocket (towards bottom)


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -