Honestly, I am new in python tcp sockets and I wrote a simple code for the server side. When I run the code locally, everything is fine and I receive the message from the local server immediately, but when I put the code on a vps (linux) and run the code with python3 test.py and send a message from client to the server, server receive the message from client and waits about 1 minute to send the message back to the client and after that everything is fine and the messages transfer between server and client without any delay. I tested other platforms such as nodejs, other vps and also setting ssl for the vps and using non-blocking mode and changed the recv() buffer size too but I faced the same thing. I used telnet and a client with python and also faced the same issue. I will be so thankful if you help me out with this. Best regards
client (also telnet)
import socket
c = socket.socket()
c.connect(('my_ip',56112))
c.send(bytes("1",'utf-8'))
c.recv(1024).decode()
c.close()
server
import socket
s=socket.socket()
print("socket created!")
s.bind(('0.0.0.0',56112))
s.listen(3)
print("waiting for connections!")
while True:
c, addr = s.accept()
name = c.recv(1024).decode()
print("connected with",addr,name)
c.send(bytes("hi there",'utf-8'))
c.close()
could you help me to solve this?