Python Forum

Full Version: tcp python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello
i want with python send message to server
I want to send messages to the server even if the server is not sending anything to the clients
or both together
I have tried with this
but if the server does not send anything to the client I cannot send anything
There is a solution?
this is the code i tried
import socket
host ='192.168.1.15'
port = 123
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM
s.connect(('192.168.1.15', port))
s.send(b'CONNECT|Prova*')
while True:
    s.send(b'SERVER|Prova*')
while True:
    msg=s.recv(1024)
    print('Recived: ' + msg.decode())
    msg = s.recv(1024)
thank you