Fixed "disconnected" bug / Updated menu music
This commit is contained in:
Binary file not shown.
@@ -103,6 +103,34 @@ public class ArcNetServer implements ServerProvider{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStream(int id, Streamable stream){
|
||||||
|
ArcConnection connection = getByID(id);
|
||||||
|
if(connection == null) return;
|
||||||
|
|
||||||
|
connection.connection.addListener(new InputStreamSender(stream.stream, 512){
|
||||||
|
int id;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void start(){
|
||||||
|
//send an object so the receiving side knows how to handle the following chunks
|
||||||
|
StreamBegin begin = new StreamBegin();
|
||||||
|
begin.total = stream.stream.available();
|
||||||
|
begin.type = Registrator.getID(stream.getClass());
|
||||||
|
connection.connection.sendTCP(begin);
|
||||||
|
id = begin.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object next(byte[] bytes){
|
||||||
|
StreamChunk chunk = new StreamChunk();
|
||||||
|
chunk.id = id;
|
||||||
|
chunk.data = bytes;
|
||||||
|
return chunk; //wrap the byte[] with an object so the receiving side knows how to handle it.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void host(int port) throws IOException{
|
public void host(int port) throws IOException{
|
||||||
connections.clear();
|
connections.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user