mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 22:38:43 +00:00
Implemented list views initialisation which will set the first pane to be your source id (after three way handshake) and the remaining pane to be the source id of other players based on boats.xml received.
Updated client parser and client state to save a list of player's boat WIP: refresh list view to show the latest update in players #story[1055]
This commit is contained in:
@@ -32,14 +32,15 @@ public class ClientToServerThread implements Runnable {
|
||||
private ByteArrayOutputStream crcBuffer;
|
||||
|
||||
public ClientToServerThread(String ipAddress, Integer portNumber) throws Exception{
|
||||
socket = new Socket(ipAddress, portNumber);
|
||||
is = socket.getInputStream();
|
||||
os = socket.getOutputStream();
|
||||
socket = new Socket(ipAddress, portNumber);
|
||||
is = socket.getInputStream();
|
||||
os = socket.getOutputStream();
|
||||
|
||||
Integer allocatedID = threeWayHandshake();
|
||||
if (allocatedID != null) {
|
||||
ourID = allocatedID;
|
||||
clientLog("Successful handshake. Allocated ID: " + ourID, 1);
|
||||
ClientState.setClientSourceId(String.valueOf(ourID));
|
||||
} else {
|
||||
clientLog("Unsuccessful handhsake", 1);
|
||||
closeSocket();
|
||||
@@ -96,13 +97,17 @@ public class ClientToServerThread implements Runnable {
|
||||
} else {
|
||||
System.err.println("Packet has been dropped");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
closeSocket();
|
||||
System.out.println("this exception");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
closeSocket();
|
||||
System.out.println("[CLIENT] Disconnected from server");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user