x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Send message to open port in a server

Hello everyone,

We have a server opened in a specific port and I want to be able to send messages to that port from an external program.

However i cant get that program to connect to the server's port. The first solution i came up with was to create a listen socket to hear that entering one, and it works just fine.

So, to avoid using 2 ports, Can we implement aditional functionality throught that port to be called from an external program?

Product Version: UE 4.20
Tags:
more ▼

asked Jan 24 '19 at 12:14 PM in C++ Programming

avatar image

Wungoche
5 1 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Well you can't connect because UE4 use UDP protocol (not TCP), which does not formally connect to server just throws packets at destination, in fact there no concept of client and server on UDP layer it's just packet throwing and forget. This also means that it is packet loss tolerable unlike TCP and there no guaranty that packet will reach destination, while TCP monitors that and makes sure that packet lands even if this means large delay and waiting (or else internet really gonna cut off and connection gonna timeout). So if you want 100% sure that your data reach the server you should use TCP socket instead.

But if you really want to then get packets from game server you cna od that in UNetConnection class more specifically UIpConnection:

https://api.unrealengine.com/INT/API/Runtime/Engine/Engine/UNetConnection/index.html ...which you can process raw packets ReceivedRawPacket function and and you can be overrided from UNetDriver and UIpNetDriver

https://api.unrealengine.com/INT/API/Plugins/OnlineSubsystemUtils/UNetDriver/index.html

Which you can in engine.ini as demostratted here:

https://github.com/EpicGames/UnrealEngine/blob/811c1ce579564fa92ecc22d9b70cbe9c8a8e4b9a/Engine/Config/BaseEngine.ini#L832

UNetConnection is extension of UPlayer, which represents the player it self (lower then APlayerController) so each player has it's own. Not sure if it's gonna accept packets from forgain ports. YOu relaly need to explore engine source code here.

more ▼

answered Jan 24 '19 at 11:38 PM

avatar image

Shadowriver
35.2k 921 166 1098

avatar image Wungoche Jan 28 '19 at 08:46 AM

After trying for a while bit i end up with a solution. Thanks for the answer and links! Right now i have managed to use the same port for both services, running in parallel, and works fantastic

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question