UE4 Version of TCPLink?

I’m looking to port a TCPLink class I have from UDK over into Rocket, but I am very confused over the new system.

In UDK the basic workflow was to Resolve() a URL, then Open() a specific port (in my case, 80), then in the Opened() event send all the necessary headers and text, then wait for ReceivedText() or Closed().

In Rocket, it seems like we use an FTcpListener? But I am unable to specify a simple URL string, it seems like it must be cast to a “FIPv4Endpoint”…not sure how to do that. And once I do make a successful connection, how do I manage sending and receiving text and closing the connection? It seems like I would call GetSocket() and use the socket’s Send() and Recv() functions, and ultimately Close(), but these do not appear to be events and I do not want to block the channel until I have data.

If there is any documentation already existing on this I apologize for not seeing it, but I would love to be pointed in the right direction!

Hi William,

For now, please continue to use the API that is available in the socket subsystem, i.e. FSocketSubsystem::GetHostByName().

The Networking module is not fully implemented yet and is currently mostly a convenience wrapper around various socket system functions. At some point we will expand the functionality of the Networking module, but I have no ETA yet.

You can safely use the FTcpListener class. Please be aware, however, that the FUdpSocketReceiver and FUdpSocketSender will likely be removed (or at least rewritten) in a future update.

Thank you for your response! GetHostByName() was indeed the function I missed. Looking forward to future updates of the networking module.

In the meantime if anyone else runs into the same thing:

  1. FSocketSubsystem::GetHostByName(“http://www.google.com”) for example (might need to convert to ANSI string first) -->this returns an FResolveInfo

  2. Call FResolveInfo::GetResolvedAddress() → this returns an FInternetAddr

  3. Instantiate an FSocket and you can call Bind() or Connect() with the FInternetAddr from step 2

  4. From here you can use the FTcpListener class with the socket and do stuff