List of utility methods to do Socket Address Get
void | writeAddress(DataOutputStream outputStream, InetSocketAddress address, int version) write Address outputStream.writeByte(version); if (version == 4 || version == 6) { for (byte b : address.getAddress().getAddress()) { outputStream.writeByte((byte) ((~b) & 255)); outputStream.writeShort(address.getPort()); } else { throw new UnsupportedOperationException("Unknown version IPV" + version + " is not yet supported"); ... |
void | writeAddress(InetSocketAddress address, DataOutput out) Writes InetSocketAddress to the specified data output. byte[] hostBytes = address.getAddress().getAddress();
out.writeByte(hostBytes.length);
out.write(hostBytes);
writeVarInt(address.getPort(), out);
|