@@ -0,0 +1,1036 @@
+# -*- coding: utf-8 -*- %0A# ----------3w task:MyDiaryNet CLI----------%0A# -------------author: bambooom-------------  %0A%0A# Echo client program%0Aimport socket%0Aimport sys%0A%0A# create socket of client to contact the server%0As = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)%0Aserver_address = ('localhost', 8250)%0A%0Ah = %5B'h','help','?'%5D%0Aq = %5B'q','quit'%5D%0Ar = %5B'r','sync'%5D%0A%0As.sendto('r', server_address) # ask server to send the latest log%0Alog, server = s.recvfrom(4096)%0Aprint log%0A%0Awhile True:%0A%09message = raw_input(' Input here%3E') # ask for input%0A%09%0A%09if message in h:%0A%09%09print %22%22%22 %0A%09%09Input h/help/? for help.%0A%09%09Input q/quit to quit the process.%0A%09%09Input r/sync to sync the diary log%0A%09%09%22%22%22 # print the help%0A%09elif message in r: # for request, contact server to send back the log%0A%09%09s.sendto(message, server_address) # client has to send the request for sync first%0A%09%09log, server = s.recvfrom(4096) # so that client can get the reply%0A%09%09print log%0A%09elif message in q:%0A%09%09print %3E%3Esys.stderr, 'Bye~'%0A%09%09break%0A%09else:%0A%09%09s.sendto(message, server_address)%0A%0As.close()%0A

Create client.py