FSocket->Bind() resulst in SE_EADDRNOTAVAIL

Hi, im going crazy over here…

I successfully created udp sockets before but now it always results in the socket error 21 “Address is not available” or as ESocketError SE_EADDRNOTAVAIL…
I tried it on different PCs with version 4.1 and 4.2…
set the Socket as reusable and not…
created everything by hand and tried the UdpSocketBuilder…

it ALWAYS resulted in this error…

I even wrote a little console application in C# to verify that my PC’s Socket API works… it does

when i debugged, i saw that my address and port order are reversed so i tried different ip adresses as A.B.C.D and D.C.B.A

Here is my code:

void AUdpActor::createSocket()
{
	ISocketSubsystem* theSocketSubsystem;
	theSocketSubsystem = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);


	ESocketErrors err;
	TSharedPtr<FSocket, ESPMode::NotThreadSafe> Socket;
	TSharedPtr<FInternetAddr, ESPMode::NotThreadSafe> addr;
	addr = theSocketSubsystem->CreateInternetAddr();

	addr->SetPort(21338);

	bool bIsValid;
	addr->SetIp(TEXT("192.168.2.222"), bIsValid);

	Socket = MakeShareable(theSocketSubsystem->CreateSocket(NAME_DGram, TEXT("testSocket"), true));
	Socket->SetReuseAddr(true);
	Socket->Bind(*addr);
	err = theSocketSubsystem->GetLastErrorCode();


	// second try with the Socket Builder
	FSocket* Socket = FUdpSocketBuilder(TEXT("SomeSocket")).BoundToAddress(FIPv4Address(192, 168, 2, 222)).BoundToPort(23123).AsReusable().Build();
}

I am glad for every suggestion someone might have…

i can however bind sockets to ip 0.0.0.0 or 127.0.0.1
but i just don’t understand why i cannot bind to other

Address 0.0.0.0 means “any adapter”. In UDP you just create a server and a host. Server can get or send messages from lots of hosts. And address of the host you can get, when recieving message. So, server dont need to know its ip. Only port. And you need to Bind ONLY server.

Thanks for your answer but i am still a little bit confused…
In all the examples on the internet (e.g. msdn article) they are setting the receiving udp socket to the sender’s ip. So if i know i’m gonna receive data from aa.bb.cc.dd i would set the ip address for my receiving socket to this address.
I know that i can just bind to the port and check the incoming frames for the right ip address and discard the wrong ones. But since every example i read on this topic binds sockets to a specific address i considered it as bad practice