- Home /
How do you cancel Network.Connect() thats in proccess of running?
is there a way to stop attemping to Network.Connect, when a button is clicked, it has to be able to also cancel, and i cant use Network.Disconnect because i havent connected either.
Answer by KiraSensei · Dec 02, 2013 at 10:05 PM
Network.Disconnect()
See HERE.
yah but, I cant call Network.Disconnect if i havent Connected to any server yet.
Answer by Bunny83 · Dec 04, 2013 at 04:10 AM
Actually there is no "process" of connecting. When you try to connect to a server you send a package to the server and wait for a response. This is totally passive. There is usually a timeout which kicks in when no replies arrives. If the connect packet can't be routed to the server you might get a response from the router which would indicate an connection error. But it's also possible that the packet is kind of "lost" or the reply couldn't be routed back to you or there's simply no server who could answer. For such cases the timeout triggers a timeout error.
Connecting to a server usually happens within 100ms - 200ms. If not you will probably run into a timeout. The best bet to cancel the "waiting" is, like KiraSensei said, Network.Disconnect().
Your answer
![](https://koobas.hobune.stream/wayback/20220613123254im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Network.Connect failed. 1 Answer
Network connection not working! 2 Answers
Can anyone help me with my network script? 1 Answer
Only Editor Can Connect with Standalone's Server 1 Answer
Networking Basics Big Problem 1 Answer