- Le plus récent
- Le plus de votes
- La plupart des commentaires
8921 works on PC and Mac if you want to just hardcode it. Only problem you'll have with using just that port is you won't be able to have multiple instances open on one Mac.
UPDATE:
Actually, here you go this code will work for both Mac and Windows.
using System.Net;
using System.Net.Sockets;
private static readonly IPEndPoint DefaultLoopbackEndpoint = new IPEndPoint(IPAddress.Loopback, port: 0);
public static int GetAvailablePort()
{
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
{
socket.Bind(DefaultLoopbackEndpoint);
return ((IPEndPoint)socket.LocalEndPoint).Port;
}
}
I've also added a Pull Request to fix this in the demo scene, if you could inform whoever is in charge of that repo @REDACTEDUSER
We have also ran into this issue and have mostly resolved it by building adding the DTLS libraries for the Unity SDK. One of our developers is still experiencing this when using his home WiFi, and in some cases it can still intermittently happen while playing our game. Is there a way to prevent the Real-time client/server to even create a UDP connection at all? We plan on using Reliable messages exclusively anyway, but if I understand correctly it seems like a failure in creating a DTLS connection is causing the client connection to be terminated by the server.
Hmm that seems odd.
Can you confirm where you got the megafrog race sample code from? From https://github.com/aws-samples/megafrograce-gamelift-realtime-servers-sample ?
Ping/Pong response code should happen automatically in the websockets layer. Theres nothing you need to do here its something the server/receiver handle automatically.
I would confirm that the player didn't drop their connection or get somehow cpu/thread bound preventing a response to the ping.
The current server code is very strict so a single failure here results in player disconnection; you could obviously make this more robust by adding a count of ping failures prior to termination.
In script you can change the pingIntervalTime configuration which may help.
Thanks for the reply, but I think I found my issue. I am working on a Mac, which doesn't support the GetActiveUdpListner function. I had read about it here: https://forums.awsgametech.com/t/going-through-tutorial-and-getting-notimplementedexception-the-method-or-operation-is-not-implemented-on-getactiveudplisteners/6561
I implemented my own version to find a free UDP Port, but it seems that did't work as I had hoped. Since I got an initial connection to the server, I thought the problem were somewhere else, but when testing it on a windows computer with the original code to find a UDP port, I had no issues and everything worked.
Thanks ever so much for the fix. I'll forward it on to the GameLift team.
Contenus pertinents
- demandé il y a un an
- demandé il y a 2 mois
- demandé il y a un an
- demandé il y a 3 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 5 mois
Hey, have you found a more concrete solution for this? Thank you, I am having similar issues and another post suggest it has to do with the cert