[bittorrent] compact ip problem

Dazen D dazensix at gmail.com
Wed Aug 22 15:07:21 EDT 2007

Hi. I'm having some problems sending announce responses
with compact ips on it. Apparently the clients don't
recognize the compact ip that i'm generating (using java
code). If i send regular ips and ports, it works fine.

To generate the four first bytes (IP) i use the code:

    String ip = (...)
    InetAddress inetAddress = InetAddress.getByName(ip);
    byte[] rawAddress = inetAddress.getAddress();

For the other two bytes (port):

    compactIP[4] = (byte)(port >> 8);
    compactIP[5] = (byte)(port & 0xff);

(which is apparently how azureus do that)

The response that is arriving to the client is:


where "XXXX" are the IP bytes and "YY" the port bytes.

I even tried another format for the response, which some trackers use:


but it was the same.

Any idea about what could be wrong?

Thanks a lot.

More information about the BitTorrent mailing list