Hello,
I was just experimenting with uLink 1.3 beta 5's changes to Open() and Close(). I noticed that it's no longer possible to re-open ports that are not listening due to exceptions without using the deprecated Open/Close methods.
This can be easily demonstrated by creating a scene with two game objects. Attach a uLink.NetworkP2P component to each game object and set their initial listening port to something, such as 7200.
Now, starting the game will cause an exception, as one of the two objects will be unable to open the relevant port - the other game object has already opened it.
Next, attach the following script to both game objects:
public class P2PInitializer : uLink.MonoBehaviour
{
public int startPort = 7200;
public int endPort = 7299;
private uLink.NetworkP2P p2p = null;
void Start()
{
p2p = networkP2P;
StartCoroutine(TryOpen());
}
IEnumerator TryOpen()
{
int currentPort = startPort;
while (!p2p.isListening && currentPort <= endPort)
{
p2p.
p2p.listenPort = currentPort;
currentPort++;
Debug.Log("Attempting to listen on " + currentPort.ToString());
yield return new WaitForSeconds(0.1f);
}
}
}
When you next start the game, you'll find that, despite having reset the listening port, p2p.isListening never becomes true.