I'm not familiar with the IP object but given it's definition:
type IpAddress = object
case family*: IpAddressFamily ## the type of the IP address (IPv4 or IPv6)
of IpAddressFamily.IPv6:
address_v6*: array[0 .. 15, uint8] ## Contains the IP address in
bytes in
## case of IPv6
of IpAddressFamily.IPv4:
address_v4*: array[0 .. 3, uint8] ## Contains the IP address in bytes
in
## case of IPv4
Run
You should use this:
case ip.family
of IPv6:
fstream.readData(ip.address_v6[0].addr, ip.address_v6.len)
of IPv4:
fstream.readData(ip.address_v4[0].addr, ip.address_v4.len)
Run