Welcome,
Guest
. Please
login
or
register
.
April 22, 2026, 07:09:37 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
TNet 3 Support
»
OnApplicationPause connection lost (video sharing feature)
« previous
next »
Print
Pages: [
1
]
Author
Topic: OnApplicationPause connection lost (video sharing feature) (Read 4590 times)
creativitysquare
Newbie
Thank You
-Given: 3
-Receive: 2
Posts: 41
OnApplicationPause connection lost (video sharing feature)
«
on:
November 24, 2014, 05:58:50 AM »
hi guys
I was wondering about the following. I am implementing Kamcord in my game and there is an issue with networking as if i record something and i watch and share it, when i go back to the game i got disconnected. I was thinking that maybe one way to prevent it would be to do something like:
public
bool
paused
;
void
LateUpdate
(
)
{
if
(
paused
)
{
System.
Net
.
IPEndPoint
ip
=
new
System.
Net
.
IPEndPoint
(
NUtils
.
SERVER_ADDRESS
, NUtils
.
SERVER_PORT
)
;
TNManager
.
Ping
(
ip, OnPing
(
)
)
;
}
}
void
OnApplicationPause
(
bool
pauseStatus
)
{
paused
=
pauseStatus
;
}
void
OnPing
(
)
{
Debug
.
Log
(
"keep alive"
)
;
}
or
void
OnApplicationPause
(
bool
pauseStatus
)
{
StartCoroutine
(
KeepConAlive
(
)
)
;
}
IEnumerator KeepConAlive
(
)
{
for
(
;
;
)
{
if
(
TNManager
.
isInChannel
)
{
if
(
TNManager
.
isThisMyObject
)
{
System.
Net
.
IPAddress
ipAd
=
new
System.
Net
.
IPAddress
(
System
.
Convert
.
ToInt64
(
NUtils
.
SERVER_ADDRESS
)
)
;
System.
Net
.
IPEndPoint
ip
=
new
System.
Net
.
IPEndPoint
(
ipAd, NUtils
.
SERVER_PORT
)
;
TNManager
.
Ping
(
ip,
null
)
;
}
yield
return
new
WaitForSeconds
(
1f
)
;
}
else
yield
return
new
WaitForSeconds
(
0
.
1f
)
;
}
}
This approach doesn't work. Any idea how can i keep the con alive?
Many thanks
CS
«
Last Edit: November 24, 2014, 06:53:45 AM by creativitysquare
»
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: OnApplicationPause connection lost (video sharing feature)
«
Reply #1 on:
November 25, 2014, 02:01:19 AM »
When the app is paused, no more updates go through. No more updates = no packets, so the connection is believed to be dead, resulting in a disconnect. You can get around it by setting the TNManager.SetTimeout to a high value.
Logged
creativitysquare
Newbie
Thank You
-Given: 3
-Receive: 2
Posts: 41
Re: OnApplicationPause connection lost (video sharing feature)
«
Reply #2 on:
December 05, 2014, 09:32:12 PM »
thanks Aren
I will try this
Logged
creativitysquare
Newbie
Thank You
-Given: 3
-Receive: 2
Posts: 41
Re: OnApplicationPause connection lost (video sharing feature)
«
Reply #3 on:
December 06, 2014, 08:06:52 AM »
It works perfectly
/// <summary>
/// Raises the application pause event.
/// </summary>
/// <param name="pauseStatus">If set to <c>true</c> pause status.</param>
void
OnApplicationPause
(
bool
pauseStatus
)
{
if
(
pauseStatus
)
{
if
(
TNManager
.
isConnected
)
TNManager
.
SetTimeout
(
180
)
;
Debug
.
Log
(
"APP PAUSED "
+
pauseStatus
)
;
}
else
{
if
(
TNManager
.
isConnected
)
TNManager
.
SetTimeout
(
10
)
;
Debug
.
Log
(
"APP UNPAUSED "
+
pauseStatus
)
;
}
}
thanks again
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
TNet 3 Support
»
OnApplicationPause connection lost (video sharing feature)