Page 1 of 1

OSError: [Errno 22] EINVAL

Posted: Wed Dec 08, 2021 7:29 pm
by bdjens
I am trying to carry 3 variables by the GET method on a pbc. and it gives me this error. Can you help me? I'm going crazy
OSError: [Errno 22] EINVAL

host = "domain.com/test/test.php"
url = "domain.com/test/test.php?a=" + str(vara) + "&b=" + str(varb) + "&c=" + str(varc)
port = 80
print(url)
s = socket.socket()
s.connect((host, port))
message = "GET /200 HTTP/1.1\r\nHost: {}\r\nConnection: close\r\n\r\n"
s.write(message.format(url))
print(s.read(256))
s.close()

Re: OSError: [Errno 22] EINVAL

Posted: Thu Dec 09, 2021 10:23 am
by pythoncoder
See the docs re socket.getaddrinfo.

Re: OSError: [Errno 22] EINVAL

Posted: Sun Dec 12, 2021 4:42 am
by bdjens
thanks for the information
But, when I put it, it tells me that it is not declared. AF_INET

socket(AF_INET, SOCK_STREAM)
s.connect(socket.getaddrinfo(url, 80)[0][-1])


I am programming on an A9G module, so I am very limited in installing libraries.

It always gives me an error.

I'm desperate, I can't get it to work in any way ... I'm not good at this

Re: OSError: [Errno 22] EINVAL

Posted: Sun Dec 12, 2021 6:19 am
by bdjens
when the host is of the form, domain.com gives a connection error, it gives me an answer that does not exist, however, when the host is domain.com/test/test.php, for the code

what difference is there between host and url?