Connecting problem
Posted: Wed May 22, 2013 12:55 am
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)
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)