# Streaming data in with an fSocket

**URL:** <https://forums.unrealengine.com/t/streaming-data-in-with-an-fsocket/356541>\
**Category:** Multiplayer & Networking\
**Tags:** udp, Networking, fsocket, unreal-engine, CPP, question\
**Created:** [May 5, 2016, 4:01pm UTC](https://forums.unrealengine.com/t/streaming-data-in-with-an-fsocket/356541 "2016-05-05T16:01:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antithing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@antithing](https://forums.unrealengine.com/u/antithing)\
**Post date:** [May 5, 2016, 4:01pm UTC](https://forums.unrealengine.com/t/streaming-data-in-with-an-fsocket/356541/1 "2016-05-05T16:01:13Z")

</div>

Hi all, I am attempting to build a simple socket connection into UE4.11.

I have this code, based on many hours internet trawling:

```
void UMyfTCPObject::Connect()
{

	UE_LOG(LogTemp, Warning, TEXT("ConnectionManager::Init"));

	FSocket* Socket = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateSocket(NAME_Stream, TEXT("default"), true);
	FString address = TEXT("localhost");
	int32 port = 19834;

	TSharedRef<FInternetAddr> addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();

	addr->SetAnyAddress();
//	addr->SetIp("127.0.0.1");
	addr->SetPort(port);

	
	UE_LOG(LogTemp, Warning, TEXT("Socket created! Connecting to server..."));
	bool didConnect = Socket->Connect(*addr);
	if (didConnect)
	{
		UE_LOG(LogTemp, Warning, TEXT("Connection state: true"));

		
	}
	else
	{
		UE_LOG(LogTemp, Warning, TEXT("Connection state: false"));
	}
}

```

But it will not connect. Always jumping to “Connection state: false”.  
Does this look correct? Or have I gone terribly wrong?

Thank you!
