title: Winsock -> WinRT Windows.Networking.Sockets -- mapping error codes
body: <p>I'm in the process of porting a C++ library to WinRT. It uses Winsock. Winsock isn't supported in WinRT. Microsoft directs you to use Windows.Networking.Sockets instead. I'm running into questions trying to map the Winsock API to the Windows.Networking.Sockets API. I've used sockets in managed code, but not in C++. I'm unfamiliar with the Winsock API.</p>
  
  <p>I'm sure I will run up against other questions, but first off, I need to determine the right way to get socket error codes. I think this is the correct mapping: WSAGetLastError() == SocketError.GetStatus(hresult)</li>
  </p>
  
  <p>Correct?</p>
  
  <ul>
  <li>This doc details possible error codes using winsock: <br/><a href="http://msdn.microsoft.com/en-us/library/ms740668(v=vs.85).aspx" rel="nofollow">Windows Sockets Error Codes</a></li>
  <li>This doc details an enumeration which I think is the equivalent, but is very different: <br/><a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.sockets.socketerrorstatus.aspx" rel="nofollow">SocketErrorStatus enumeration</a></li>
  </ul>
  
  <p>The number of error codes is very different between these two. Also, WSAGetLastError() returns the error status for the last Windows Sockets operation that failed, where SocketError.GetStatus(hresult) requires an hresult as input, presumably from exception handling of a specific attempted operation. This is going to require a good bit of refactoring to make this change, so I want to make sure I've got it right before I do the work.</p>
  
  <p>Lastly, is there a document someone can refer me to that defines the mapping I'm looking for?</p>