I just add “Networking” and “Sockets” to build.cs. and then use the .uproject file to Generate visual studio project files.
The code i am adding is a udp client that is in an actor component attached to a cine camera actor.
Here is the code:
`
#include “NewActorComponent.h”
#include “Networking.h”
#include “Sockets.h”
#include “SocketSubsystem.h”
UPROPERTY(EditAnywhere)
FIPv4Address IP(127, 0, 0, 1);
UPROPERTY(EditAnywhere)
int32 Port = 80;
uint8_t* RecevedBytes;
int32 ReadedBytes;
//TSharedRef Addr;
TSharedPtr Addr;
FSocket* Socket;
ESocketReceiveFlags::Type Flags;
// Sets default values for this component’s properties
UNewActorComponent::UNewActorComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don’t need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UNewActorComponent::BeginPlay()
{
Super::BeginPlay();
Port = 6301;
Addr->SetIp(IP.Value);
Addr->SetPort(Port);
Addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
Socket = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateSocket(NAME_Stream, TEXT("Socket"), false);
bool Connected = Socket->Connect(*Addr);
Flags = ESocketReceiveFlags::None;
// ...
}
// Called every frame
void UNewActorComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
Socket->Recv(RecevedBytes, 67, ReadedBytes, Flags);
// …
}
`
Here are crash files after relaunching the project.
Fatal error: [File:D:\Build++UE4+Release-4.19+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2499] None is not being constructed with either NewObject, NewNamedObject or ConstructObject.
UE4Editor_CoreUObject!UObject::ConditionalBeginDestroy() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:884]
UE4Editor_CoreUObject!StaticExit() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:4226]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance::ExecuteIfSafe() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:788]
UE4Editor!TBaseMulticastDelegate::Broadcast() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:937]
UE4Editor!FEngineLoop::AppPreExit() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:4052]
UE4Editor!FEngineLoop::Exit() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2885]
UE4Editor!GuardedMain() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\launch.cpp:177]
UE4Editor!GuardedMainWrapper() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:144]
UE4Editor!WinMain() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:223]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
kernel32
ntdll
I used the steps in this post:
to find out what .dll files are missing.The dll files that are missing are: aqProf.dll, VtuneApi.dll, VtuneApi32e.dll ,PhysXUpdateLoader64.dll, amdihk64.dll.