title: TCP port using python - how to forward command output to tcp port?
body: <p>I want to develop a code in python which will open a port in the localhost and will send the logs to that port. Logs will be nothing but the command output of a python file.</p>
  
  <p>like :</p>
  
  <pre><code>hello.py
  
  i = 0  
  while True:  
      print "hello printed %s times." % i  
      i+=1
  </code></pre>
  
  <p>this will continuously print the statement.
  I want this cont. output to be sent to opened port.</p>
  
  <p>can anyone tell me how I can do the same?</p>
  
  <p>Thanks in advance</p>