Connecting problem

Post Reply
User avatar
New Member
Posts: 21
Joined: Fri Jul 15, 2011 8:24 pm
Location: Copperas Cove, Texas

Connecting problem


Post by ilikesci »

I am trying to connect to the sandbox. I assuming I need to create a socket and then to connect to it. The s.connect((host, port)) is throwing an error. I am hoping then I should recv a username request where I could send my username, etc. I am new at socket programming and programming in python. Am I going to have to connect with ssl or will this way work? It does give me the port is 443. Any help is appreciated.

here is the error:
s.connect((host, port))
socket.gaierror: [Errno 11004] getaddrinfo failed

here is the code:

import socket, sys

host = ""

print("Creating socket...")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

print("Looking up port number...")
port = int(socket.getservbyname("https", "tcp"))

print("Connecting to remote host on port = ", port)
s.connect((host, port))

buf = s.recv(2048)

input("Hit enter to continue", something)
Post Reply

Return to “Software Development”