:\internet\socketspython getfile py -mode client -host learning-python com -port -file python exe :\internet\socketspython getfile py -host learning-python com -file index html one subtle security point herethe server instance code is happy to send any serverside file whose pathname is sent from clientas long as the server is run with username that has read access to the requested file if you care about keeping some of your server-side files privateyou should add logic to suppress downloads of restricted files 'll leave this as suggested exercise herebut we will implement such filename checks in different getfile download tool later in this book adding user-interface frontend after all the gui commotion in the prior part of this bookyou might have noticed that we have been living in the realm of the command line for this entire -our socket clients and servers have been started from simple dos or linux shells nothing is stopping us from adding nice point-and-click user interface to some of these scriptsthoughgui and network scripting are not mutually exclusive techniques in factthey can be arguably "sexywhen used together well for instanceit would be easy to implement simple tkinter gui frontend to the clientside portion of the getfile script we just met such toolrun on the client machinemay simply pop up window with entry widgets for typing the desired filenameserverand so on once download parameters have been inputthe user interface could either import and call the getfile client function with appropriate option argumentsor build and run the implied getfile py command line using tools such as os systemos popensubprocessand so on using row frames and command lines to help make all of this more concretelet' very quickly explore few simple scripts that add tkinter frontend to the getfile client-side program all of these examples assume that you are running server instance of getfilethey merely add gui for the client side of the conversationto fetch file from the server the firstin example - uses form construction techniques we met in and to create dialog for inputting serverportand filename informationand simply constructs the #we'll see three more getfile programs before we leave internet scripting the next getfile py fetches file with the higher-level ftp interface instead of using raw socket callsand its http-getfile scripts fetch files over the http protocol later presents server-side getfile py cgi script that transfers file contents over the http port in response to request made in web browser client (files are sent as the output of cgi scriptall four of the download schemes presented in this text ultimately use socketsbut only the version here makes that use explicit simple python file server