#!/usr/bin/python
import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 5000                 # Reserve a port for your service.
s.bind((host, port))        # Bind to the port

s.listen(5)                 # Now wait for client connection.
print 'server running on port {0}'.format(port)
while True:
   c, addr = s.accept()     # Establish connection with client.
   print 'Got connection from', addr
   while True:
        print 'enter your message:'
        msg = raw_input()
        if msg == 'bye!':
            print msg
            c.send(msg)
            break
        else:
            c.send(msg)
   print 'waiting for another client'

   c.close()                # Close the connection

@@ -62,17 +62,67 @@
  module%0A
-%0A
+class Server:%0A    def __init__(self):%0A        self.
 s = sock
@@ -166,16 +166,29 @@
  object%0A
+        self.
 host = s
@@ -232,16 +232,29 @@
 ne name%0A
+        self.
 port = 5
@@ -308,16 +308,29 @@
 ervice.%0A
+        self.
 s.bind((
@@ -368,17 +368,29 @@
 he port%0A
-%0A
+        self.
 s.listen
@@ -443,16 +443,24 @@
 ection.%0A
+        
 print 's
@@ -499,16 +499,46 @@
 t(port)%0A
+%0A    def serve(self):%0A        
 while Tr
@@ -541,16 +541,25 @@
 e True:%0A
+         
    c, ad
@@ -614,16 +614,25 @@
 client.%0A
+         
    print
@@ -660,16 +660,25 @@
 ', addr%0A
+         
    while
@@ -688,24 +688,32 @@
 ue:%0A        
+     
+   
 print 'enter
@@ -728,16 +728,24 @@
 ssage:'%0A
+        
         
@@ -770,16 +770,24 @@
         
+    
+    
 if msg =
@@ -796,16 +796,20 @@
 'bye!':%0A
+    
         
@@ -826,32 +826,36 @@
 msg%0A            
+    
 c.send(msg)%0A    
@@ -850,16 +850,20 @@
 nd(msg)%0A
+    
         
@@ -872,16 +872,28 @@
   break%0A
+            
         
@@ -902,32 +902,40 @@
 se:%0A            
+   
+     
 c.send(msg)%0A   p
@@ -930,16 +930,29 @@
 nd(msg)%0A
+             
    print
@@ -982,16 +982,29 @@
 lient'%0A%0A
+             
    c.clo

change server into object orientated class