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"

Client Disconnect

I am trying to handle when a client disconnects from a server (via a system crash/network failure) but can't seem to find any callbacks that are called when the client disconnects. Is there a callback or some kind of handle for the host to know when a client has lost connection?

I've tried OnNetworkFailure functions which does give information back to the client if a host quits but doesn't seem to work for the host/server.

Product Version: Not Selected
Tags:
more ▼

asked Oct 14 '14 at 09:12 AM in C++ Programming

avatar image

Dune
1.9k 52 39 200

avatar image KillerPenguin Nov 25 '14 at 01:54 AM

Hmmm couldn't find anything on this too. Any help?

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

4 answers: sort voted first

try Overriding PlayerState::OnDeactivated

more ▼

answered Oct 05 '16 at 07:33 PM

avatar image

George Li
186 3 12 21

avatar image George Li Oct 07 '16 at 07:37 PM

Sorry, this is server side only

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

Perhaps using EndPlay will help?

 AActor::EndPlay()

More details here: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/EndPlay/index.html

It at least provides a reason for the end. Although, it doesn't say if they client disconnected, but would at least say if/when they were removed from the level.

more ▼

answered Oct 07 '16 at 10:45 AM

avatar image

Jawdy
356 2 4 6

avatar image George Li Oct 07 '16 at 07:53 PM

It doesn't work. When your client is disconnected from the server, the engine will try to reconnect within a certain time. During this time, actors are not destroyed. Even though the connection is down, actors still stay.

All what I need is to display something to the player when disconnection happens.

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

In GameMode there is a Logout() and OnLogout() that is called when a player exits game. You can also override the Destroyed() function of the PlayerController.

more ▼

answered Oct 07 '16 at 05:08 PM

avatar image

antsonthetree
86 4 9 12

avatar image George Li Oct 07 '16 at 07:38 PM

This is still server side.

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

in GameInstance, there is a function can override in blueprint HandleNetworkError

this maybe you want

more ▼

answered May 23 '17 at 04:19 AM

avatar image

feiwu
296 2 6 20

(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