Notice in the following code we generated an exception because 66000 is an invalid port number:
import smtplib
smtplib.SMTP('127.0.0.1', port=66000)
Observe that the call start starts in smtplib.py
and as it goes down moves into socket.py
. The socket
module is Python's standard interface for the transport layer, and provides the functions for interacting with TCP and UDP as well as for looking up hostnames through DNS. In this particular instance, the application layer protocol has employed a transport layer protocol.
At the bottom of the traceback we see [Errno 8]
; This is an error message from the operating system, and we can indeed verify it has been generated by the OS by looking through the errno.h
files on our system. The socket
module is calling down yet again and asking the OS to manage the TCP connection for it.