networked programs 'hello worldb'hello world'hello worldencode( 'hello world retrieving an image over http in the above examplewe retrieved plain text file which had newlines in the file and we simply copied the data to the screen as the program ran we can use similar program to retrieve an image across using http instead of copying the data to the screen as the program runswe accumulate the data in stringtrim off the headersand then save the image data to file as followsimport socket import time host 'data pr orgport mysock socket socket(socket af_inetsocket sock_streammysock connect((hostport)mysock sendall( 'get count picture "while truedata mysock recv( if len(data break #time sleep( count count len(dataprint(len(data)countpicture picture data mysock close(look for the end of the header ( crlfpos picture find( "\ \ \ \ "print('header length'posprint(picture[:posdecode()skip past the header and save the picture data picture picture[pos+ :fhand open("stuff jpg""wb"fhand write(picturefhand close(codewhen the program runsit produces the following output