Connecting problem

User avatar
ilikesci
New Member
Posts: 21
Joined: Fri Jul 15, 2011 7:24 pm
Location: Copperas Cove, Texas
Contact:

Connecting problem

Postby ilikesci » Tue May 21, 2013 11:55 pm

Hello,
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 = "https://sandbox.familysearch.org/tree"

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

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

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

buf = s.recv(2048)
sys.stdout.write(buf)

s.close()
input("Hit enter to continue", something)

Return to “Software Development”

Who is online

Users browsing this forum: No registered users and 1 guest