import socket
import sys

sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost',10000)
print >>sys.stderr,'Starting up server on "%s" port %s' %server_address

sock.bind(server_address)
sock.listen(1)

#while True:
print>>sys.stderr,'Waiting for Connection'
connection, client_address = sock.accept()
 
while True:
      data = connection.recv(64)
      print>>sys.stderr,'received "%s"'%data
      if data:
         print>>sys.stderr,'sending data back to client'
         connection.sendall(data)
      else:
         print>>sys.stderr,'No more packets from client. Closing Connection '
         break

connection.close()
