local hostnamethe local hostname is the human-readable form of the combination of the host and port for examplethe website www myplace com might resolve to an address of : (where the first four numbers are the host address and the number after the colon is the portpython takes care of these details behind the scenes for youso normally you don' need to worry about them howeverit' nice to know that this information is available now that you have better idea of how the address is put togetherit' time to look at it more carefully the following sections describe the envelope of an -mail in more precise terms host host address is the identifier for connection to server just as an address on an envelope isn' the actual locationneither is the host address the actual server it merely specifies the location of the server the connection used to access combination of host address and port is called socket just who came up with this odd name and why isn' important what is important is that you can use the socket to find out all kinds of information that' useful in understanding how -mail works the following steps help you see hostnames and host addresses at work more importantyou begin to understand the whole idea of an -mail envelope and the addresses it contains open python shell window you see the familiar python prompt type import socket and press enter before you can work with socketsyou must import the socket library this library contains all sorts of confusing attributesso use it with caution howeverthis library also contains some interesting functions that help you see how the internet addresses work type socket gethostbyname("localhost"and press enter you see host address as output in this caseyou should see as output because localhost is standard hostname the address is associated with the host namelocalhost type socket gethostbyaddr( "and press enter be prepared for surprise you get tuple as outputas shown in figure - howeverinstead of getting localhost as the name of the hostyou get the name of your machine you use localhost as common name for the local machinebut when you specify the addressyou get the machine name instead in this casemain is the name of my personal machine the name you see on your screen will correspond to your machine