Java Utililty Methods Socket Address Get

List of utility methods to do Socket Address Get

Description

The list of methods to do Socket Address Get are organized into topic(s).

Method

voidwriteAddress(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");
...
voidwriteAddress(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);