Go to the latest version of this document.

# ``twisted`.`internet`.`protocol`.`BaseProtocol``

class documentation

`class BaseProtocol: (source)`

Known subclasses: `twisted.internet.protocol.ProcessProtocol`, `twisted.internet.protocol.Protocol`

View In Hierarchy

This is the abstract superclass of all protocols.

Some methods have helpful default implementations here so that they can easily be shared, but otherwise the direct subclasses of this class are more interesting, `Protocol` and `ProcessProtocol`.

Method | `connectionMade` | Called when a connection is made.
Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `connected` | Undocumented
Instance Variable | `transport` | Undocumented

def connectionMade(self): (source)
overridden in `twisted.conch.insults.helper.TerminalBuffer`, `twisted.conch.insults.insults.ClientProtocol`, `twisted.conch.insults.insults.ServerProtocol`, `twisted.conch.scripts.cftp.StdioClient`, `twisted.conch.ssh.filetransfer.FileTransferClient`, `twisted.conch.ssh.session.SSHSessionProcessProtocol`, `twisted.conch.ssh.transport.SSHTransportBase`, `twisted.conch.stdio.TerminalProcessProtocol`, `twisted.conch.telnet.AuthenticatingTelnetProtocol`, `twisted.conch.telnet.AuthenticatingTelnetProtocol`, `twisted.conch.telnet.TelnetBootstrapProtocol`, `twisted.conch.telnet.TelnetTransport`, `twisted.internet.testing.AccumulatingProtocol`, `twisted.internet.testing.LineSendingProtocol`, `twisted.mail.imap4.IMAP4Client`, `twisted.mail.imap4.IMAP4Server`, `twisted.mail.pop3.AdvancedPOP3Client`, `twisted.mail.pop3.POP3`, `twisted.mail.smtp.SMTP`, `twisted.mail.smtp.SMTPClient`, `twisted.names.dns.DNSProtocol`, `twisted.protocols.ftp.DTP`, `twisted.protocols.ftp.FTP`, `twisted.protocols.ftp.FTPOverflowProtocol`, `twisted.protocols.policies.TrafficLoggingProtocol`, `twisted.protocols.portforward.ProxyClient`, `twisted.protocols.portforward.ProxyServer`, `twisted.protocols.postfix.PostfixTCPMapServer`, `twisted.protocols.socks.SOCKSv4`, `twisted.protocols.socks.SOCKSv4Outgoing`, `twisted.protocols.wire.Chargen`, `twisted.protocols.wire.Daytime`, `twisted.protocols.wire.QOTD`, `twisted.protocols.wire.Time`, `twisted.protocols.wire.Who`, `twisted.runner.inetd.InetdProtocol`, `twisted.runner.procmon.LoggingProtocol`, `twisted.spread.banana.Banana`, `twisted.trial._dist.worker.LocalWorker`, `twisted.web._http2.H2Connection`, `twisted.web._newclient.HTTP11ClientProtocol`, `twisted.web._newclient.HTTPParser`, `twisted.web.http.HTTPChannel`, `twisted.web.http.HTTPClient`, `twisted.web.sux.XMLParser`, `twisted.web.twcgi.CGIProcessProtocol`, `twisted.words.protocols.irc.DccFileReceive`, `twisted.words.protocols.irc.DccSendProtocol`, `twisted.words.protocols.irc.IRC`, `twisted.words.protocols.irc.IRCClient`, `twisted.words.xish.xmlstream.XmlStream`, `twisted.conch.ssh.session._ProtocolWrapper`, `twisted.internet.endpoints._WrappingProtocol`, `twisted.internet.utils._EverythingGetter`

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def makeConnection(self, transport): (source)
overridden in `twisted.protocols.amp.BinaryBoxProtocol`, `twisted.protocols.basic.NetstringReceiver`, `twisted.protocols.ftp.ProtocolWrapper`, `twisted.protocols.ftp.SenderProtocol`, `twisted.protocols.policies.ProtocolWrapper`, `twisted.protocols.stateful.StatefulProtocol`, `twisted.internet.endpoints._WrapIProtocol`

Make a connection to a transport and a server.

This sets the 'transport' attribute of this Protocol, and calls the connectionMade() callback.

connected: `int` = (source)
overridden in `twisted.conch.ssh.filetransfer.FileTransferBase`, `twisted.protocols.tls.TLSMemoryBIOProtocol`, `twisted.words.protocols.irc.DccFileReceive`, `twisted.words.protocols.irc.DccSendProtocol`

Undocumented

transport: `ITransport | None` = (source)
overridden in `twisted.conch.telnet.Telnet`, `twisted.internet.protocol.ProcessProtocol`, `twisted.mail.pop3.AdvancedPOP3Client`, `twisted.protocols.amp.BinaryBoxProtocol`, `twisted.protocols.ftp.FTP`, `twisted.protocols.portforward.ProxyServer`

Undocumented