1

I want to use DatagramSockets in a WP8 app to talk to an SSDP/UDP device (a Sony ActionCam) but I can't find the Windows.Networking DLL as it's not in any of the normal places you add references from. It does seem to live in various places on my Windows 8 machine but if I try to add it from somewhere like %Windows%/system32 it tells me it's not possible (which I guess because there's no Type Library?).

So can someone please tell me what I am missing? Is there some other SDK I need to download? I've looked all through the MSDN docs and though it mentions the namespace in plenty of detail it doesn't tell me how to find or add it for a WP8 app (typical MS).

Hope someone can help me - I'm clearly missing something obvious but I don't understand what or why.

nzmike
  • 578
  • 1
  • 7
  • 25
  • I just tested here. `using Windows.Networking.Sockets;` is showing up just fine. Even this little code is working: `var socket = new DatagramSocket();`. This only happens with WinPhone Apps or with any other type of Project? – trinaldi Oct 06 '13 at 18:51
  • Thanks for your reply Tico. If I create a normal Windows 8 Store app I can see the DLL and add it but when I try the same in a WP8 project the DLL is not there. Did you have to add the reference to Windows.Networking? If so, on your system, what path was it on? If I just go into my code and add "using Windows." I get no intellisense and it immediately marks the namespace as being in error.... there must be something else one has to do to enable using Windows DLLs... back to Google again I guess! – nzmike Oct 06 '13 at 21:09
  • I just typed `using Windows.Networking` Intellisense did its job. Maybe you should reinstall you SDK. From [What's new in Windows Phone SDK 8.0](http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206940%28v=vs.105%29.aspx): `Incoming sockets Windows Phone 8 introduces the enhancements to incoming sockets. System.Net.Sockets and Windows.Networking.Sockets both support incoming sockets, which means your app can listen for an incoming network connection, and then bind to that connection.` – trinaldi Oct 06 '13 at 21:13

3 Answers3

0

Ok, I solved it - I have absolutely no idea why this was happening but it seems like VS2012 was the culprit. In desperation I saved the code I needed, deleted the entire solution and recreated it and now I can see the Windows namespace members.... bizarre! Also very, very annoying - I have wasted hours on this, apparently all because of some internal issue with VS2012.

Thanks for your input Tico, apologies if I wasted your time!

nzmike
  • 578
  • 1
  • 7
  • 25
0

Just to follow up on this - I had the same issue. For me, I had to select .Net Framework 4.5 instead of 4.0. Creating a new solution in 4.0 within VS2012 wouldn't allow access to the Windows.Networking library. But 4.5 worked perfectly.

SeatSherpa
  • 33
  • 6
0

Just another idea of what might have gone wrong since i myself stumbled upon that mistake right now. Instead of a windows phone class library i added a portable class library (supporting windows phone 8 and windows store 8+ with .net 4.5). Seems like that combination doesn't support Windows.Networking

Andreas
  • 478
  • 4
  • 16