0
votes

How to make my own photon unity networking server in the localhost, not in the cloud specified there.

I have tried to use "Self Hosted" Hosting and tried the localhost and the device's IP address but every time I am getting the following error

Receive issue. State: Connected. Server: 'localhost' ErrorCode: 10054 SocketErrorCode: ConnectionReset Message: An existing connection was forcibly closed by the remote host. System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.

I have also tried to change the port number its using and also verified whether the port is being used or not by some other process or not.

Still, I can't make the photon server in the localhost. Can anyone please tell me how to make it in localhost?

1
try to set it to 0.0.0.0 instead of localhost - Any Moose
Thanks for the reply. But showing socket exception while using 0.0.0.0.Connect() to '0.0.0.0' (InterNetwork) failed: System.Net.Sockets.SocketException: The requested address is not valid in its context. Any other solutions or suggestions? - MSD Paul
Have you opened the firewall? Or are you trying to access from the same machine. - Any Moose
Try to edit the references to 127.0.0.1 - Any Moose
I have already disabled the firewall and just now trying to use in the localhost. Not on the other machine. I already tried to use 127.0.0.1 as the server address under PhotonServerSettings but same error. Any other solutions. - MSD Paul

1 Answers

0
votes

I had the same problem when I created a PhotonPeer with ConnectionProtocol.Udp. I was able to resolve it by using ConnectionProtocol.Tcp instead:

peer = new PhotonPeer(this, ConnectionProtocol.Tcp);

With this change, I was able to connect to the server.