a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #!/usr/bin/env python
- import SocketServer
- import time
- class GreetingHandler(SocketServer.BaseRequestHandler):
- Class to handle sending a greeting to a client
- def handle(self):
- Method to actually handle the greeting
- print 'Handling the request.'
- data = self.request.recv(1024)
- self.request.sendall('Request received: %s \n' % data)
- def manageServer():
- Function to manage the running of the server and handling of requests
- servObj = SocketServer.TCPServer(('localhost',6099), GreetingHandler)
- print 'Starting the server...'
- if __name__ == '__main__':
RAW Paste Data