- Home /
Extend Network.Connect's connection attempt time
Begins I didn't get an answer to the question I asked last time I asked, I'll ask again:
Is there a way to adjust how long Network.Connect attempts to connect before it gives up, right now it seems to attempt for about 8 seconds before giving up if it can't find the host, I was wondering if that time could be made longer?
Example: You click the connect button, which triggers this piece of code (JUST ONCE and INSTANTLY) when you click:
Network.Connect(AValidAndExistingIP, AValidPort);
By default, that continues to try for (about) 8 seconds before it gives up and returns an error that it couldn't connect, I want to know if there is a way to extend how long it TRYS TO CONNECT. Because right now, if you had an 800ms ping, you wouldn't be able to connect, mind you if you were playing an FPS, you'd obviously quit the server, but in this case I'm not using the code for an fps, and things will still work with pings higher than 8 seconds, the important part is they need to be able to connect, regardless how bad their ping is.
I hope that leaves less confusion as to what I'm actually asking this time.
Answer by AKAssassin · Apr 25, 2011 at 07:20 PM
You should not be concerned with the amount of time it spends trying to connect, 800ms ping would not take longer than 8 seconds, it would be 8/10s of a second. Anyways, you should just keep trying to reconnect over and over again.
So.. //Connect
if(failedToConnect){ //Attempt to connect again, probably will want to stop doing this after a while though //and accept the fact that connection isn't going to happen. }
Your answer
Follow this Question
Related Questions
Network.Connect Connect Attempt Timeout 1 Answer
Unity server connection time out 0 Answers
Ragdoll joints aren't staying connected. 0 Answers
Unhandled message 65 from local ip. 0 Answers