mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
@@ -13,13 +13,13 @@ import java.nio.channels.WritableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class StreamingServerSocket {
|
||||
public class StreamingServerSocket {
|
||||
private ServerSocketChannel socket;
|
||||
private SocketChannel client;
|
||||
private short seqNum;
|
||||
private boolean isServerStarted;
|
||||
|
||||
StreamingServerSocket(int port) throws IOException{
|
||||
public StreamingServerSocket(int port) throws IOException{
|
||||
socket = ServerSocketChannel.open();
|
||||
socket.socket().bind(new InetSocketAddress("localhost", port));
|
||||
//socket.setSoTimeout(10000);
|
||||
@@ -27,7 +27,7 @@ class StreamingServerSocket {
|
||||
isServerStarted = false;
|
||||
}
|
||||
|
||||
void start(){
|
||||
public void start(){
|
||||
try {
|
||||
client = socket.accept();
|
||||
} catch (IOException e) {
|
||||
@@ -41,7 +41,7 @@ class StreamingServerSocket {
|
||||
}
|
||||
}
|
||||
|
||||
void send(Message message) throws IOException{
|
||||
public void send(Message message) throws IOException{
|
||||
if (client == null){
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user