Add preliminary net code

This commit is contained in:
Flare Microsystems
2024-11-10 21:06:09 -08:00
parent 38bda530c5
commit 4aacdd2b44
6 changed files with 146 additions and 14 deletions

View File

@@ -7,28 +7,15 @@ import java.io.IOException;
import com.flaremicro.crossjeeves.net.NetworkHandler;
public class Packet127KeepAlive extends Packet{
long fileId;
short chunkSize;
byte[] fileChunk;
public Packet127KeepAlive(){
}
public Packet127KeepAlive(long fileId, byte[] fileChunk){
this.fileId = fileId;
this.chunkSize = (short)fileChunk.length;
this.fileChunk = fileChunk;
}
public void recievePacket(DataInputStream in) throws IOException {
fileId = in.readLong();
}
public void sendPacket(DataOutputStream out) throws IOException {
super.sendPacket(out);
out.writeLong(fileId);
out.writeShort(chunkSize);
out.write(fileChunk);
}
public void processPacket(NetworkHandler networkHandler){