client receivedb'echo=>hello network worldclient receivedb'echo=>hello network worldclient receivedb'echo=>hello network worldclient receivedb'echo=>hello network worldas you can seewith such sleepy server clients are spawnedbut only receive serviceand fail with exceptions unless clients require very little of the server' attentionto handle multiple requests overlapping in time we need to somehow service clients in parallel we'll see how servers can handle multiple clients more robustly in momentfirstthoughlet' experiment with some special ports talking to reserved ports it' also important to know that this client and server engage in proprietary sort of discussionand so use the port number outside the range reserved for standard protocols ( to there' nothing preventing client from opening socket on one of these special portshowever for instancethe following client-side code connects to programs listening on the standard emailftpand http web server ports on three different server machinesc:\pp \internet\socketspython from socket import sock socket(af_inetsock_streamsock connect(('pop secureserver net' )talk to pop email server print(sock recv( ) '+ok \ \nsock close(sock socket(af_inetsock_streamsock connect(('learning-python com' )talk to ftp server print(sock recv( ) ' welcome to pure-ftpd [privsep[tls\ \ -yousock close(sock socket(af_inetsock_streamsock connect(('www python net' )talk to python' http server sock send( 'get /\ \ 'fetch root page reply sock recv( '<!doctype html public "-// //dtd xhtml strict//en"\ \ sock recv( 'www org/tr/xhtml /dtd/xhtml -strict dtd">\ \ <html xmlns="if we know how to interpret the output returned by these portsserverswe could use raw sockets like this to fetch emailtransfer filesand grab web pages and invoke serverside scripts fortunatelythoughwe don' have to worry about all the underlying details--python' poplibftpliband http client and urllib request modules provide higher-level interfaces for talking to servers on these ports other python protocol socket programming