How To Connect Python Socket Client Side To Server Socket With Url - Stack Overflow
How To Connect Python Socket Client Side To Server Socket With Url - Stack Overflow
host_ip = socket.gethostbyname('HOST_NAME')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', 0))
sock.connect((host_ip, 8080))
python sockets
Why are you bind ing the socket? This is used if you are the server. – ForceBru Mar 25 '17 at 16:37
import socket
This is a simple snippet, which connects to the server, sends some data, and prints the
response.
Share Improve this answer Follow answered Mar 25 '17 at 18:34
Ealhad
1,224 15 24