Unreal Engine Winsock version

Hello there

I’m using Winsock in my project and want to use Winsock 2.2. I initiate Winsock using WSAStartup(0x0202, &wsaData), but it doesn’t work (only in UE4, otherwise it works). I think the reason for this is that Unreal Engine 4 uses Winsock 1.1 version in the core. I need to use Winsock 2.2.

Before, when i checked UE4 source files, i found the file that uses Winsock1.1 (Source\Runtime\Sockets\Private\Windows\SocketSubsystemWindows.cpp(Init function)).

Then, i disabled it or changed Winsock1.1 with Winsock2.2 and recompiled it, but it didn’t work.

How can i solve this problem? Can i disable UE4 Winsock of the core.

Answers here:

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1713933-include-winsock2-h-not-working

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1446900-issue-with-macro-redefinition

I already know and use this. I can use my Winsock Wrapper Lib without any problem. But Winsock version is not 2.2, although i use WSAStartup(0x0202, &wsaData).

Is anything wrong?


#ifdef _WIN32
#include “Windows/AllowWindowsPlatformTypes.h”
#include “Windows/PreWindowsApi.h”
#endif

#include “…/…/…/…/…h”
#include “…/…/…/…/Socket.h” // has #pragma comment(lib, “Ws2_32.lib”) line
#include “…/…/…/…/NetPacket.h”





// put this at the bottom of the .h file
// UE4: disallow windows platform types
// this was enabled at the top of the file

#ifdef _WIN32
#include “Windows/PostWindowsApi.h”
#include “Windows/HideWindowsPlatformTypes.h”
#endif

Oh hmm. Not sure about that one. :frowning: