I’m testing out a Socket Client/Server connection based on an example that I found here and I seem to be having problems connecting to the server using ConnectAsync when I’m running on webplayer.
I found a similar thread and the mod said that this would be fixed on the next release (This thread is more than 2 years old by the way)
It connects fine with an error (I assume it just needs a little tweaking) when running it in standalone setting so i’m not really sure what’s wrong.
Is this not supported when using webplayer? How about in iOS? Can you suggest the most efficient way to establish a client-server connection?
PS. As much as possible I do not want to use 3rd party servers such as ElectroServer, SF, Photon, etc
I apologize if this question has been answered already.
I’m pretty sure I already have considered the thing about crossdomain.xml and i’m also only using the webplayer as a client. The methods i’m using should be supported as it is included in the their compatibility list. Can you be more specific on what I may have missed?
Also, is it possible to use the UnityEngine.Network and UnityEngine.NetworkView classes to talk to a non-unity application?
webplayers can’t act as socket targets normally as they can not fullfill the requirement of being specified in a socket policy - crossdomain.xml as neither of the two is on the IP as the webplayer when its executed by a user.
If the other side is no webplayer and if its on a fixed IP / domain there is no problem, photon - sfs and many other centralized server solutions work exactly this way (they all have an integrated policy server - unity offers you a standalone run to run side by side to your server if you don’t use a webpage ie have no place use for the crossdomain.xml)
Sockets in unity are to target fixed domain names / IP so a webserver or a standalone server app running on a machine of yours or something that runs on 127.0.0.1 like a flash / java plugin side by side to the unity one. But you can not use sockets for peer 2 peer webplayer communication. webplayers as servers is only possible through unity networking.
the documentation if I recall right even documents that limitation.
As for unity networking talking to non unity: it is possible but a lot of work and requires reverse engineering on the packets as UT has not made the informations public required to use Raknet 3.7.xxxx as server side.
I’m not sure if I understand 100% what you just said but I am not planning to make a peer-to-peer connection. Instead, a client-server connection with a console-based C# application on a dedicated server on the other end. What might be the problem here?
Can you teach me more regarding this “integrated policy server”?
In that case you really want to run the Policy Server that comes with Unity on the same machine you are running your server application or replicate what it does.
More on it is written on the security sandbox documentation page that appels linked above, generally it does the same thing as a silverlight policy server for example.
I think I got it. It’s late though so I’ll try it tomorrow. Can anyone confirm if this list is updated? According to that, the Unity iPhone/Android API does not support sockets but I’ve read they do have it in the PRO version. Can anyone confirm this? I do not want to rewrite my socket service if possible.
You’ve been a big help, Dreamora. Thank you very much
Off topic question: If I buy the iPhone basic license now then suddenly decide to upgrade to iPhone PRO, would the payment for the iPhone basic be wasted or do i just have to pay the difference?
Right, iOS / Android require the corresponding Pro addon license to use System.Net and sockets, which require that your Unity base license you upgrade is Pro as well.
Upgrade: You only pay the difference. Just insert your current license key on the store and it will tell you what you would pay for what upgrade / addon