WIP: Implemented a temporary workaround to send an instance test to client server upon connection.

Still needs reengineering to change socket channels for sending to ouput stream in the message class.
Only client to server "working".

#story[1047] #pair[hyi25, wmu16] #pair[cir27, zyt10]
This commit is contained in:
Haoming Yin
2017-07-17 17:00:04 +12:00
parent 4b8ac32ca9
commit 63958a6717
12 changed files with 154 additions and 68 deletions
@@ -6,6 +6,7 @@ import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import seng302.client.ClientTransmitterThread;
import seng302.gameServer.GameServerThread;
import seng302.gameServer.GameState;
import seng302.gameServerWithThreading.MainServerThread;
@@ -26,6 +27,8 @@ public class StartScreenController {
@FXML
private GridPane startScreen2;
private Controller controller;
/**
* Loads the fxml content into the parent pane
* @param jfxUrl
@@ -62,10 +65,10 @@ public class StartScreenController {
String ipAddress = InetAddress.getLocalHost().getHostAddress();
new GameState(ipAddress);
new MainServerThread().start();
// new GameServerThread("Fuck you");
// get the lobby controller so that we can pass the game server thread to it
setContentPane("/views/LobbyView.fxml");
} catch (UnknownHostException e) {
System.err.println("COULD NOT FIND YOUR IP ADDRESS!");
e.printStackTrace();
@@ -78,7 +81,17 @@ public class StartScreenController {
public void connectButtonPressed() {
// TODO: 10/07/17 wmu16 - Finish function
String ipAddress = ipTextField.getText().trim().toLowerCase();
//startClientTransmitterThread();
StreamReceiver sr = new StreamReceiver(ipAddress, 4950, "HostStream");
sr.start();
}
public void setController(Controller controller) {
this.controller = controller;
}
public void startClientTransmitterThread() {
this.controller.setClientTransmitterThread(new ClientTransmitterThread("RaceVision Test Client Transmitter"));
}
}