title: Where is sockaddr_in in Windows RT?
body: <p>According to MSDN (<a href="http://msdn.microsoft.com/en-us/library/zx63b042.aspx" rel="nofollow">VS2012 version</a>), <code>sockaddr_in</code> is defined in <code>winsock2.h</code>. There are no exceptions stated (similar to what we see with Windows Phone and some API calls). Yet when I try to compile a file which uses <code>sockaddr_in</code> and includes <code>winsock2.h</code>, I get a compile error (below).</p>
  
  <p>Notice that I don't receive a <code>winsock2.h not found</code> error (or similar). Also note that the same code compiles on Windows Phone 8.</p>
  
  <p>What does one need to include for WinRT?</p>
  
  <pre><code>        cl /Fotmp32dll\bss_conn.obj  -Iinc32 -Itmp32dll -DOPENSSL_THREADS  -W3 -
  Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WINRT -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_
  CRT_SECURE_NO_DEPRECATE -I\usr\local\ssl\fips-2.0/include /nologo /D NDEBUG /D _
  USRDLL /D _WINDLL /D WINAPI_FAMILY=WINAPI_PARTITION_APP /FI SDKDDKVer.h /FI wina
  pifamily.h -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_ENGI
  NE -DOPENSSL_NO_HW -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE
  /Zi /Fdtmp32dll/lib  -DOPENSSL_BUILD_SHLIBCRYPTO -c .\crypto\bio\bss_conn.c
  bss_conn.c
  .\crypto\bio\bss_conn.c(95) : error C2079: 'them' uses undefined struct 'sockadd
  r_in'
  .\crypto\bio\bss_conn.c(207) : error C2224: left of '.sin_family' must have stru
  ct/union type
  .\crypto\bio\bss_conn.c(207) : error C2065: 'AF_INET' : undeclared identifier
  .\crypto\bio\bss_conn.c(208) : error C2224: left of '.sin_port' must have struct
  /union type
  .\crypto\bio\bss_conn.c(208) : warning C4013: 'htons' undefined; assuming extern
   returning int
  .\crypto\bio\bss_conn.c(214) : error C2224: left of '.sin_addr' must have struct
  /union type
  .\crypto\bio\bss_conn.c(214) : warning C4013: 'htonl' undefined; assuming extern
   returning int
  .\crypto\bio\bss_conn.c(217) : warning C4013: 'socket' undefined; assuming exter
  n returning int
  .\crypto\bio\bss_conn.c(217) : error C2065: 'AF_INET' : undeclared identifier
  .\crypto\bio\bss_conn.c(217) : error C2065: 'SOCK_STREAM' : undeclared identifie
  r
  .\crypto\bio\bss_conn.c(217) : error C2065: 'IPPROTO_TCP' : undeclared identifie
  r
  .\crypto\bio\bss_conn.c(218) : error C2065: 'INVALID_SOCKET' : undeclared identi
  fier
  .\crypto\bio\bss_conn.c(220) : warning C4013: 'WSAGetLastError' undefined; assum
  ing extern returning int
  .\crypto\bio\bss_conn.c(260) : warning C4013: 'connect' undefined; assuming exte
  rn returning int
  .\crypto\bio\bss_conn.c(366) : error C2065: 'INVALID_SOCKET' : undeclared identi
  fier
  .\crypto\bio\bss_conn.c(379) : error C2065: 'INVALID_SOCKET' : undeclared identi
  fier
  .\crypto\bio\bss_conn.c(383) : warning C4013: 'shutdown' undefined; assuming ext
  ern returning int
  .\crypto\bio\bss_conn.c(384) : warning C4013: 'closesocket' undefined; assuming
  extern returning int
  .\crypto\bio\bss_conn.c(385) : error C2065: 'INVALID_SOCKET' : undeclared identi
  fier
  .\crypto\bio\bss_conn.c(422) : warning C4013: 'WSASetLastError' undefined; assum
  ing extern returning int
  .\crypto\bio\bss_conn.c(423) : warning C4013: 'recv' undefined; assuming extern
  returning int
  .\crypto\bio\bss_conn.c(447) : warning C4013: 'send' undefined; assuming extern
  returning int
  NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
  \VC\bin\x86_ARM\cl.EXE"' : return code '0x2'
  Stop.
  </code></pre>