🐛 modifications
continuous-integration/drone/push Build is passing Details

ServerDeployement
Bruno DA COSTA CUNHA 2 years ago
parent f87243c262
commit 2f4a18c494

@ -58,6 +58,7 @@ public class PongServer
if (data.Informations.Action == Shared.DTO.Action.Connect) // Join = rejoindre un room , et Host ça va juste créer un room
{
var choisenRoom = rooms.FirstOrDefault(room => room.Value.Availaible);
Console.WriteLine("Connection " + choisenRoom.Key);
if (choisenRoom.Value != default )
{
Join(data, remoteEndPoint, serverSocket, choisenRoom.Value);
@ -85,7 +86,7 @@ public class PongServer
room.playerHost = new KeyValuePair<Player,UdpClient>(data.Data,clientSocket);
room.nbPlayer++;
room.PropertyChanged += room.OnReadyChanged;
Console.WriteLine("New connection Host From " + remoteEndPoint.ToString());
@ -93,12 +94,15 @@ public class PongServer
room.Port = nextPort;
nextPort++;
clients[remoteEndPoint] = clientSocket;
// Send connection message to client
byte[] connectionData = Encoding.ASCII.GetBytes(room.Id);
byte[] connectionData = Encoding.ASCII.GetBytes(nextPort.ToString());
serverSocket.Send(connectionData, connectionData.Length, remoteEndPoint);
rooms[data.Data.playerId] = room;
room.PropertyChanged += room.OnReadyChanged;
}
private void Join(ObjectTransfert<Player> data, IPEndPoint remoteEndPoint, UdpClient serverSocket, Room room)

Loading…
Cancel
Save