Opened 10 years ago

Closed 8 years ago

#2738 defect closed duplicate (duplicate)

t.i.a.IPv4Address.host containing host name instead of ip address

Reported by: toidinamai Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

The following program

from twisted.internet.protocol import Protocol, ClientFactory

class TestProtocol(Protocol):
    def connectionMade(self):
        peer = self.transport.getPeer()
        print "I'm connected to %s on port number %s." % (peer.host, peer.port)
        self.transport.loseConnection()

class TestFactory(ClientFactory):
    protocol = TestProtocol

if __name__ == "__main__":
    import sys
    from twisted.internet import reactor
    reactor.connectTCP(sys.argv[1], sys.argv[2], TestFactory())
    reactor.run()

when run as python test.py localhost ssh should print

I'm connected to 127.0.0.1 on port number 22.

but instead prints

I'm connected to localhost on port number 22.

This seems to be a bug as the documentation for t.i.a.IPv4Address states that the host attribute should be "a string containing the dotted-quad IP address".

Change History (2)

comment:1 Changed 8 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

#3059 was a duplicate of this, and fortunately has been resolved.

comment:2 Changed 7 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.