# Freeze when using FTcpListener?

**URL:** <https://forums.unrealengine.com/t/freeze-when-using-ftcplistener/310949>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 14, 2015, 4:25pm UTC](https://forums.unrealengine.com/t/freeze-when-using-ftcplistener/310949 "2015-03-14T16:25:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 14, 2015, 4:25pm UTC](https://forums.unrealengine.com/t/freeze-when-using-ftcplistener/310949/1 "2015-03-14T16:25:56Z")

</div>

Hey,

I am trying to use an FTcpListener in a file server.

My problem is that the game freezes as soon as i call the FTcpListener::Run() function.

I couldn’t find any example of how to use this class in google or in the ShooterGame.

Debugging tells me that i am stuck in the while(!Stopping) loop of TcpListener.h (line 149).

Here is my code:

```
void UYagFileServer::Start(uint32 ServerPort)
{
	// server only
	if (FileServerGameState->Role < ROLE_Authority) return;

	// listening socket
	FIPv4Endpoint Endpoint(FIPv4Address(127, 0, 0, 1), ServerPort);
	
	ListenerSocket = FTcpSocketBuilder("ServerListeningSocket")
		.AsReusable()
		.BoundToEndpoint(Endpoint)
		.Listening(8);

	//Set Buffer Size
	int32 ReceiveBufferSize = 2 * 1024 * 1024;
	int32 NewSize = 0;
	ListenerSocket->SetReceiveBufferSize(ReceiveBufferSize, NewSize);

	YagTcpListener = new FTcpListener(*ListenerSocket);
	YagTcpListener->OnConnectionAccepted().BindUObject(this, &UYagFileServer::ListenToMessage);
		
	// the game freezes when i run this line:
	if (YagTcpListener->Init())	YagTcpListener->Run();
}

```

The listener is listening all right though:

![34164-ftcplistener_listening.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/6/7065e7d06967f24db8b18225a33deb2a9371d068.jpeg)

Am i doing anything wrong ?

Thanks

Cedric

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 15, 2015, 10:46am UTC](https://forums.unrealengine.com/t/freeze-when-using-ftcplistener/310949/2 "2015-03-15T10:46:16Z")

</div>

Ok, some progress, i didn’t know i didn’t need to call the run function, that’s why i got stuck^^
