# Simulate client disconnect while PIE?

**URL:** <https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974>\
**Category:** Community & Industry Discussion\
**Tags:** client, pie, unreal-engine, simulation, question\
**Created:** [July 5, 2016, 5:57am UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974 "2016-07-05T05:57:45Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![WoefulMacabre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WoefulMacabre](https://forums.unrealengine.com/u/WoefulMacabre)\
**Post date:** [July 5, 2016, 5:57am UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/1 "2016-07-05T05:57:45Z")

</div>

Howdy,

Not sure which section to post this in, but at any rate, I was wondering if there was any way to prevent the closing of one client closing all other clients and ending a PIE test.

Essentially, whenever I’m testing, if I try to close out of one client to simulate what happens when someone “quits” or an unexpected network disconnect, it closes all clients and ends PIE - much like pressing ESC on any of them or manually stopping PIE. Is it possible to stop this or should this not be happening?

4.5.1 if that’s of any worth.

-WM

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_069d30bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_069d30bd](https://forums.unrealengine.com/u/anonymous_user_069d30bd)\
**Post date:** [September 22, 2016, 7:21pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/2 "2016-09-22T19:21:50Z")

</div>

This is a few months old, but no one answered, and this came up as my first google result on the issue…

You can use the disconnect command to make the user disconnect. This will not close their window, but they will leave the server, and load whichever the start level is, but in single player.

---

<div class="post-metadata">

**Author:** ![Rarp7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rarp7](https://forums.unrealengine.com/u/Rarp7)\
**Post date:** [January 7, 2017, 10:11pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/3 "2017-01-07T22:11:41Z")

</div>

saved me from packaging my game a million times over, thanks !

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_deecf88c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_deecf88c](https://forums.unrealengine.com/u/anonymous_user_deecf88c)\
**Post date:** [March 13, 2017, 7:49pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/4 "2017-03-13T19:49:57Z")

</div>

In 4.12.5 running “disconnect” on one client disconnects all clients.  
Has anybody found another way to do this? It would immensely help us test & reproduce bugs.

---

<div class="post-metadata">

**Author:** ![SantaCop](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SantaCop](https://forums.unrealengine.com/u/SantaCop)\
**Post date:** [June 8, 2018, 3:37am UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/5 "2018-06-08T03:37:30Z")

</div>

Version 4.19.2 - “disconnect” works as expected.

---

<div class="post-metadata">

**Author:** ![SantaCop](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SantaCop](https://forums.unrealengine.com/u/SantaCop)\
**Post date:** [June 8, 2018, 3:39am UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/6 "2018-06-08T03:39:52Z")

</div>

“open 127.0.0.1:17777” to reconnect

---

<div class="post-metadata">

**Author:** ![Commander\_Shepard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Commander\_Shepard](https://forums.unrealengine.com/u/Commander_Shepard)\
**Post date:** [August 18, 2019, 6:54pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/7 "2019-08-18T18:54:38Z")

</div>

The problem with this method on 4.22 is AGameModeBase::Logout will not be called in PIE mode

---

<div class="post-metadata">

**Author:** ![TheDogtoy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheDogtoy](https://forums.unrealengine.com/u/TheDogtoy)\
**Post date:** [March 3, 2023, 10:24pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/8 "2023-03-03T22:24:42Z")

</div>

Thank you for posting that logout will not be called on gamemode, I’ve been stuck on this for hours.

---

<div class="post-metadata">

**Author:** ![TheDogtoy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheDogtoy](https://forums.unrealengine.com/u/TheDogtoy)\
**Post date:** [March 3, 2023, 11:02pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/9 "2023-03-03T23:02:20Z")

</div>

I have a pretty decent solution for this. You can make a blueprint callable function in C++ that calls Logout on the game mode. One note: your not really logging out so you need a “bIsLoggingOut” to track once the player “starts logging out” so you can switch off that logic. Lets me test all my disconnect/reconnect logic easy enough though 🙂

The onStartTurn event was just me forcing a logout when the player turn started. Suggest makign a “Force Logout” event and call it from wherever.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/2/2c244af2b8eed6cd2644ab5d76a97fe36f05736e.png)

---

<div class="post-metadata">

**Author:** ![FunGames55](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fungames55/32/710746_2.png) [@FunGames55](https://forums.unrealengine.com/u/FunGames55)\
**Post date:** [September 24, 2024, 11:13pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/10 "2024-09-24T23:13:37Z")

</div>

In Unreal 5.4.4 at least I am seeing logout get called now with console command `disconnect`

---

<div class="post-metadata">

**Author:** ![Michalkhan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Michalkhan](https://forums.unrealengine.com/u/Michalkhan)\
**Post date:** [October 3, 2024, 6:31pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/11 "2024-10-03T18:31:20Z")

</div>

> [@WoefulMacabre](#):
>
> Howdy,
> 
> Not sure which section to post this in, but at any rate, I was wondering if there was any way to prevent the closing of one client closing all other clients and ending a PIE test.
> 
> Essentially, whenever I’m testing, if I try to close out of one client to simulate what happens when someone “quits” or an unexpected network disconnect, it closes all clients and ends PIE - much like pressing ESC on any of them or [manually](https://gbapponline.com/) stopping PIE. Is it possible to stop this or should this not be happening?

To address this, you might want to check your project settings under “Editor Preferences” to see if there’s an option related to handling multiple clients during PIE. Also, consider using the “Play with New Editor Window” option for each client, as this sometimes allows for more independent control. If the problem persists, it might be worth reaching out to the Unreal Engine community or checking their documentation for any updates or workarounds specific to your version. Good luck!

---

<div class="post-metadata">

**Author:** ![Nizami\_Nz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nizami\_Nz](https://forums.unrealengine.com/u/Nizami_Nz)\
**Post date:** [November 28, 2024, 7:21pm UTC](https://forums.unrealengine.com/t/simulate-client-disconnect-while-pie/362974/12 "2024-11-28T19:21:23Z")

</div>

Write - “disconnect” into client console command
