Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity Example Bug : Client Cannot Reconnect After Exceed 5 Sec No Received Disconnect #547

Open
SinForLove opened this issue Apr 23, 2024 · 4 comments

Comments

@SinForLove
Copy link

Unity example use broadcast to send discovery connect , it works when first connect. But after one or more reconnect it doesn't not work no longer. Client send discover request and server received, but when server reply the connect request client cannot receive the request. please help!!!!!

@RevenantX
Copy link
Owner

RevenantX commented May 10, 2024

@SinForLove can you send additional information like logs, how you reconnecting or DisconnectReason details?

@SinForLove
Copy link
Author

@SinForLove can you send additional information like logs, how you reconnecting or DisconnectReason details?

I just use git default unity example and not do any change. I disable the server script and build to android phone as a client, on PC I enable the server script and disable client script as server . Start the server and client on a same wireless router.After they connect success ,I put client app to background and keep about 5 sec , server logs"a peer disconnected as Timeout". Then I put client app back to front , server start logs "[SERVER] Received discovery request. Send discovery response" every frame, and cannot reconnect any more...
image

@RevenantX
Copy link
Owner

@SinForLove replace LiteNetLib.dll in example with library sources. This is needed thing for android/ios

Always use library sources instead of precompiled DLL files ( because there are platform specific #ifdefs and workarounds for unity bugs )

@SinForLove
Copy link
Author

@SinForLove replace LiteNetLib.dll in example with library sources. This is needed thing for android/ios

Always use library sources instead of precompiled DLL files ( because there are platform specific #ifdefs and workarounds for unity bugs )

I replace LiteNetLib.dll but still the same. I resolve it by adding a script in OnApplicationFocuse to reopen client NetManager when client from back to front. So I guess it's because the thread used to receive messages has been closed when the program moves from the foreground to the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants