Xinetd & python server script. problem to get data from from client

ilia.meerovich at gmail.com ilia.meerovich at gmail.com
Mon Jul 30 02:53:59 EDT 2007


Hello
I wrote simple script to test communication:
When i connect via telnet like: "telnet localhost 51423" the server is
working send and receive information. but when i connected to him via
client scrip so client script receive messages from server but server
doesn't receive message from client. In xinetd.conf and servers conf
file "only_from = 0.0.0.0/0" already choosen. What can i do?
Here below are my client and server:
Thank you :)

Server:

#!/usr/bin/env python
# example

import sys
import os

print "Wellcome"
print "please enter the string"
sys.stdout.flush()
line = sys.stdin.readline().strip()
print "You entered %d characters." % len(line)
sys.stdout.flush()

client:

import sys
import string
import os
import time
import socket
import popen2

PORT = 51423
HOST = ""#sys.argv[1]
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))
print "Connected from:", sock.getsockname()
print "Connected to:",sock.getpeername()
while 1:
     print "waiting"
     result = sock.recv(1024)
     print result
     sock.send('foo')
     print "Sent: foo"
     if result == 3:
         break




More information about the Python-list mailing list