Skip to content

Commit

Permalink
fix file connection port/ip
Browse files Browse the repository at this point in the history
  • Loading branch information
silentbaws committed May 29, 2020
1 parent 88a6b65 commit c192353
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions XLMultiplayer/MultiplayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class MultiplayerController : MonoBehaviour{
private bool closedByPeer = false;
private bool problemDetectedLocally = false;

private string serverIPString = "";
private ushort serverPort = 7777;

private Thread networkMessageThread;

public List<string> chatMessages = new List<string>();
Expand Down Expand Up @@ -283,6 +286,8 @@ public void ConnectToServer(string ip, ushort port, string user) {
} catch (Exception) { }
}

serverPort = port;
serverIPString = serverIP.ToString();

Address remoteAddress = new Address();
remoteAddress.SetAddress(serverIP.ToString(), port);
Expand Down Expand Up @@ -506,8 +511,7 @@ public void Update() {
if (GameManagement.GameStateMachine.Instance.CurrentState.GetType() == typeof(GameManagement.ReplayState)) {
controller.replayController.TimeScale = ReplayEditorController.Instance.playbackController.TimeScale;
controller.replayController.SetPlaybackTime(ReplayEditorController.Instance.playbackController.CurrentTime);



if (controller.playerID == 255 && ((controller.replayController.ClipFrames.Last().time < ReplayEditorController.Instance.playbackController.CurrentTime && controller.skater.activeSelf) || (controller.replayController.ClipFrames.Count == 0 && controller.skater.activeSelf))) {
controller.skater.SetActive(false);
controller.board.SetActive(false);
Expand Down Expand Up @@ -638,7 +642,7 @@ private void ProcessMessage(byte[] buffer) {
fileClient = new NetworkingSockets();

Address remoteAddress = new Address();
remoteAddress.SetAddress("127.0.0.1", 7778);
remoteAddress.SetAddress(serverIPString, (ushort)(serverPort + 1));

fileConnection = fileClient.Connect(ref remoteAddress);

Expand Down
2 changes: 1 addition & 1 deletion XLMultiplayerServer/FileServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void ServerLoop() {

Console.WriteLine($"Gameplay port: {Server.port}, File Server Port: {(ushort)(Server.port + 1)}");

address.SetAddress("::0", 7778);
address.SetAddress("::0", (ushort)(Server.port + 1));

listenSocket = server.CreateListenSocket(ref address);
pollGroup = server.CreatePollGroup();
Expand Down

0 comments on commit c192353

Please sign in to comment.