- Home /
Is it possible to connect to two servers at same time?
To prelude, I am using Unity3D with primarily C#/.NET development.
And so we have a rather complicated design in our game concept, but the essence boils down to connecting to 2 different servers at the same time. There is a master server which manages players and does various stateless operations, and then there are client hosted matches (peer-peer). I would like to be pipe data to the master server while a client is connected to another client.
My guess is that the master server might have to be written as a dll / separate .net app? Any suggestions on approaching this architecture would be greatly useful.
Answer by jashan · Sep 11, 2010 at 12:55 PM
With Unity's built-in networking, you cannot connect to multiple servers. That's one of the most severe limitations I see with Unity's built-in networking. The reason you can't connect to multiple servers is because the API provided by Unity simply doesn't provide entities for multiple servers (many of the method calls are static, so ... there can only be one). Of course, the advantage is that setting up networking is quite a bit easier for noobs (the kind that dreams of doing the next great MMO) - but that simplicity comes at the cost of flexibility (no MMO with Unity's built-in networking for now ;-) ).
MasterServer is a term that's used quite a bit in the context of Unity's built-in networking ... in that context, it's basically the server that matches clients with servers (it doesn't really do much "communication-stuff" ... just match-making).
However, as you're saying you're primarily doing .NET development, you are likely using sockets and in that case, you can do pretty much anything you like.
Be warned, though: When you're doing Web players (which is kind of likely), Unity 3 will add some security features that makes things a bit more complicated to set up. In particular, it might get pretty difficult to connect directly between different clients (peer-to-peer). This restriction doesn't apply to standalones, though.
Answer by qJake · Sep 10, 2010 at 09:12 PM
If you're using Unity's networking, I have no idea. If you're rolling your own networking, of course you can connect to two servers at once, in fact, you can connect to as many servers as you want. For each server, just initiate a new TCP (or UDP) connection.
Without knowing the specifics of your networking setup, or what libraries you're using, I can't help you more. All I can say is that it's 100% possible, in fact, the concept that you could only initiate one TCP/UDP connection at one time is rather laughable.
Answer by DaveA · Sep 11, 2010 at 01:24 AM
You could have that master server just be a LAMP or whatever you like, and send HTTP requests at it to record scores, no? My app talks to video servers, robotic control servers, the master server, and peers all at once. Using the WWW it's easy.
Hi Could you give some detail resolutions? I means using WWW to implement Peer2Peer resolution. I do the Peer2Peer using .NET socket, but on webplayer version, there is a security problem. I have no idea to do this with .NET Socket. Could you gimme some suggestion?
Penny
Yeah, 3.0 introduced security. You need to put a small xml file on each server that you want to get info from. Pretty much the same as Flash. I got clues on this here: http://kb2.adobe.com/cps/142/tn_14213.html
$$anonymous$$y crossdomain.xml file looks like this:
Your answer
Follow this Question
Related Questions
Master server list shows local (192.168...) IP 0 Answers
Unity networking tutorial? 6 Answers
How to pass values between networked players? 1 Answer
MasterServer with Unet ? 1 Answer
UDP Server Or Master Server 1 Answer