Python Forum
tcp python - Printable Version

+- Python Forum (
+-- Forum: Python Coding (
+--- Forum: Networking (
+--- Thread: tcp python (/thread-30366.html)

tcp python - Michele83 - Oct-17-2020

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 =''
port = 123
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM
s.connect(('', port))
while True:
while True:
    print('Recived: ' + msg.decode())
    msg = s.recv(1024)
thank you