Answered by:
Can Win8 use WinSocket2 implemented in earlier platforms?

Question
-
Hi all,
In Win8 developer preview, I can use WinSocket2, which exists since Windows XP or even earlier platforms, such as ioctlsocket, etc. I can use them to connect with Windows Metro style App or desktop app via TCP/UDP, etc. However, in Win8 Consumer preview, I cannot use WinSocket2... which means, lots of socket engine/component for earlier platforms cannot be used in Win8. So my question is, can Win8 use WinSocket2? Thanks a lot!
Tuesday, March 20, 2012 7:44 AM
Answers
-
_tcscmp, _tcscpy, etc. aren't Win32 API. They are probably fine, but that will depend on the underlying implementation. I suspect that VC6's C runtime library will not pass certification, but that may not affect you if you only use string functions and not (for example) file IO functions.
Calling API from a DLL counts the same as if you called them from your app itself. While you can bypass the compile-time restrictions intended to help you avoid disallowed API, the app will still fail certification.
See Win32 and COM for Metro style apps for the list of available API. Your app will not pass certification if it tries to use them. See How to test your app with the Windows App Certification Kit for instructions on testing if your app will pass certification locally.
--Rob
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, March 22, 2012 2:36 AM
Thursday, March 22, 2012 2:36 AMModerator
All replies
-
Hi Dongjing,
Metro apps can use only the Sockets in the Windows.Networking.Sockets namespace:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.sockets.aspxMatt Small - Microsoft Escalation Engineer - Forum Moderator
- Proposed as answer by Matt SmallMicrosoft employee, Moderator Tuesday, March 20, 2012 7:44 PM
Tuesday, March 20, 2012 7:44 PMModerator -
Hi Matt,
Yesterday I just tested with a demo and found that if I checked the Private Networks (Client & Server) capability, I can use WinSocket2 APIs. If I integrate these APIs into a dll and invoke the dll via DllImport, then I can use them for TCP/UDP connections. It's a good news I think, I can reuse the dll written in former platforms. Thanks!
Wednesday, March 21, 2012 1:28 AM -
WinSock2 is not available to Metro style apps. See Win32 and COM for Metro style apps for the list of available API. Your app will not pass certification if it tries to use them.
--Rob
Wednesday, March 21, 2012 1:32 AMModerator -
Thanks! That means I will try to use Metro style sockets http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.sockets.aspxWednesday, March 21, 2012 2:01 AM
-
Hi Rob,
Can I use other Win32 APIs, such as _tcscmp, _tcscpy, etc? Is there any criterion which I can use, which I cannot?
In my current metro style APP, I first used VC6 to generate a dll, wrapping theWinSock2.h APIs for TCP/UDP connetcions. Then I add this dll into project and use DllImport to use the API, I found I can use them for broadcasting, and file transfering. So this is also forbidden?
I can add only metro style dlls? Am I right?
Thanks!
- Edited by Dongjjing Thursday, March 22, 2012 2:30 AM
Wednesday, March 21, 2012 11:56 AM -
_tcscmp, _tcscpy, etc. aren't Win32 API. They are probably fine, but that will depend on the underlying implementation. I suspect that VC6's C runtime library will not pass certification, but that may not affect you if you only use string functions and not (for example) file IO functions.
Calling API from a DLL counts the same as if you called them from your app itself. While you can bypass the compile-time restrictions intended to help you avoid disallowed API, the app will still fail certification.
See Win32 and COM for Metro style apps for the list of available API. Your app will not pass certification if it tries to use them. See How to test your app with the Windows App Certification Kit for instructions on testing if your app will pass certification locally.
--Rob
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, March 22, 2012 2:36 AM
Thursday, March 22, 2012 2:36 AMModerator