Arthur Clarck writes:
> ...
> The problem I have now is the following.
> I have a script to connect to some telecom service.
> The script is forking (parent/child)
> The child is only reading what comes from the remote server.
> Here the problematic code:
>
> total = ''
> while True:
>data = s
Arthur Clarck :
> What is happening is that I got some datas from the remote site,
> Something like 'Contacting BH: ...'
> But directly followed by 'remote site is closed.
This works:
#!/usr/bin/env python3
import sys, soc
I forgot to mention that with this code:
total = ''
while True:
data = s.recv(1024)
total += data
if (total != ''):
print total
total = ''
Everything is fine.
I am still looping but I get the complete data flow sent by the remote server.
The data flow is not corrupted
Hello,
I am starting socket scripting with python.
I do understand from the doc that a socket is bmocking by default.
I wrote 2 basics script to verify this behaviour.
my "tcp_server.py":
import socket, sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = '192.168.0.103'
PORT = 106