Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The upper part makes a dictionary using the AF_
, SOCK_
, and IPPROTO_
prefixes that map the protocol number to their names."
A block of code is set as follows:
import socket rmip ='127.0.0.1' portlist = [22,23,80,912,135,445,20] for port in portlist: sock= socket.socket(socket.AF_INET,socket.SOCK_STREAM) result = sock.connect_ex((rmip,port)) print port,":", result sock.close()
Any command-line input or output is written as follows:
>>> dict(( getattr(socket,n),n) for n in dir(socket) if n.startswith('AF_')) {0: 'AF_UNSPEC', 2: 'AF_INET', 6: 'AF_IPX', 11: 'AF_SNA', 12: 'AF_DECnet', 16: 'AF_APPLETALK', 23: 'AF_INET6', 26: 'AF_IRDA'}
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "The Destination and Source addresses are the Ethernet addresses usually quoted as a sequence of 6 bytes."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.