import java.net.*;
import java.io.*;
import java.net.*;
import java.util.zip.*;

class ReliableDatagramSocket extends DodgyDatagramSocket
{
    private static void readBytesFromLong(long l, byte b[])
    {
	b[0] = (byte)((l & 0xff00000000000000l) >> 56);
	b[1] = (byte)((l & 0x00ff000000000000l) >> 48);
	b[2] = (byte)((l & 0x0000ff0000000000l) >> 40);
	b[3] = (byte)((l & 0x000000ff00000000l) >> 32);
	b[4] = (byte)((l & 0x00000000ff000000l) >> 24);
	b[5] = (byte)((l & 0x0000000000ff0000l) >> 16);
	b[6] = (byte)((l & 0x000000000000ff00l) >> 8);
	b[7] = (byte) (l & 0x00000000000000ffl);
	return;
    }

    private static long readLongFromBytes(byte[] b, int i)
    {
	long l, t;

	l = 0;
	t = b[i];   l |= ((t << 56) & 0xff00000000000000l);
	t = b[i+1]; l |= ((t << 48) & 0x00ff000000000000l);
	t = b[i+2]; l |= ((t << 40) & 0x0000ff0000000000l);
	t = b[i+3]; l |= ((t << 32) & 0x000000ff00000000l);
	t = b[i+4]; l |= ((t << 24) & 0x00000000ff000000l);
	t = b[i+5]; l |= ((t << 16) & 0x0000000000ff0000l);
	t = b[i+6]; l |= ((t << 8)  & 0x000000000000ff00l);
	t = b[i+7]; l |= (t         & 0x00000000000000ffl);

	return l;
    }

    private static int readIntFromBytes(byte[] b, int i)
    {
	int r = 0;
	int t;

	t = b[i];   r |= ((t << 24) & 0xff000000);
	t = b[i+1]; r |= ((t << 16) & 0x00ff0000);
	t = b[i+2]; r |= ((t << 8)  & 0x0000ff00);
	t = b[i+3]; r |= (t         & 0x000000ff);

	return r;
    }

    private static void readBytesFromInt(int i, byte b[])
    {
	b[0] = (byte)((i & 0xff000000) >> 24);
	b[1] = (byte)((i & 0x00ff0000) >> 16);
	b[2] = (byte)((i & 0x0000ff00) >> 8);
	b[3] = (byte) (i & 0x000000ff);

	return;
    }

    public ReliableDatagramSocket() throws SocketException
    {
	/*
	 * initiliase the structures and variables you need to maintain
	 * state here, and then call the constructor for DodgyDatagramSocket
	 */
	super();
    }

    public ReliableDatagramSocket(int port) throws SocketException
    {
	/*
	 * initiliase the structures and variables you need to maintain
	 * state here, and then call the constructor for DodgyDatagramSocket
	 */
	super(port);
    }


    /* Override send method to append ReliableDatagramSocket headers etc */
    public void send(DatagramPacket p) throws IOException
    {
	DatagramPacket newp = null;

	/* create a new packet (newp) with headers */

	/*
	 * eventually, we'll be sending it.  with a sliding window protocol,
	 * the send function will be called by a worker thread.
	 */
	super.send(newp);
    }
}
