Message8521

Author santa4nt
Recipients amak, irmen, santa4nt, zyasoft
Date 2014-05-22.00:35:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1400718959.37.0.830301332683.issue2078@psf.upfronthosting.co.za>
In-reply-to
Content
Netty4 is strange... you can bind its ServerBootstrap with an Inet4Address, but when you query the Channel it returns for its local address, you get an Inet6Address!

Here's a print-peppered _realsocket.listen() method:

def listen(self, backlog):
    # ...
    print 'Binding to {:s} with type {:s}'.format(repr(self.bind_addr.getAddress()), type(self.bind_addr.getAddress()))
    future = b.bind(self.bind_addr.getAddress(), self.bind_addr.getPort())

    # ...

    self.channel = future.channel()
    localaddr = self.channel.localAddress()
    print 'The channel is bound to {:s} with type {:s}'.format(repr(localaddr.getAddress()), type(localaddr.getAddress()))

    # ...


And what you get when you execute that modified method:

Binding to /0.0.0.0 with type <type 'java.net.Inet4Address'>
The channel is bound to /0:0:0:0:0:0:0:0 with type <type 'java.net.Inet6Address'>


And that's why you get an IPv6 '0' address from getsockname() after binding it with IPv4 '0' address.
History
Date User Action Args
2014-05-22 00:35:59santa4ntsetmessageid: <1400718959.37.0.830301332683.issue2078@psf.upfronthosting.co.za>
2014-05-22 00:35:59santa4ntsetrecipients: + santa4nt, amak, irmen, zyasoft
2014-05-22 00:35:59santa4ntlinkissue2078 messages
2014-05-22 00:35:58santa4ntcreate