<s> import time <EOL> import SocketServer <EOL> class MyTCPHandler ( SocketServer . BaseRequestHandler ) : <EOL> def handle ( self ) : <EOL> self . data = self . request . recv ( <NUM_LIT> ) . strip ( ) <EOL> print "<STR_LIT>" . format ( self . client_address [ <NUM_LIT:0> ] ) <EOL> print self . data <EOL> splitted = self . data . split ( '<STR_LIT>' ) <EOL> print "<STR_LIT>" , splitted <EOL> if splitted [ <NUM_LIT:0> ] == '<STR_LIT:start>' : <EOL> self . request . sendall ( '<STR_LIT>' ) <EOL> elif splitted [ <NUM_LIT:0> ] == '<STR_LIT:end>' : <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> self . request . sendall ( "<STR_LIT>" ) <EOL> elif splitted [ <NUM_LIT:0> ] == '<STR_LIT:status>' : <EOL> self . request . sendall ( "<STR_LIT>" ) <EOL> else : <EOL> self . request . sendall ( "<STR_LIT>" ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> HOST , PORT = "<STR_LIT:localhost>" , <NUM_LIT> <EOL> class MyTCPServer ( SocketServer . TCPServer ) : <EOL> allow_reuse_address = True <EOL> server = MyTCPServer ( ( HOST , PORT ) , MyTCPHandler ) <EOL> print "<STR_LIT>" . format ( HOST , PORT ) <EOL> server . serve_forever ( ) </s>
