|
c eval sock = socket(AF_INET: SOCK_STREAM: c IPPROTO_IP) c if sock < 0 c callp die('socket(): ' + %str(strerror(errno))) c return c endif
Can you please verify that you are, in fact, passing SOCK_STREAM for the 2nd parameter (like you posted here). If so, can you please verify that SOCK_STREAM is a constant, and it's value is 1.
If you passed SOCK_DGRAM, or set the value of SOCK_STREAM to 2, it would exhibit the exact behavior that you're describing, because when you issue a connect() on a UDP socket, all it does is set the "destination" address on future datagrams, it doesn't actually send anything at the time you run it, thus it would succeed but no connection would be made.
So please make absolutely sure that AF_INET=2, SOCK_STREAM=1 and IPPROTO_IP=0 in your definitions.
The only other thing is that you're calling a prototype called addrCvtr(), and I don't know what that does. I've never heard of that before. This API is not a standard sockets API (unless you've renamed it!) and can't be found by searching the Information Center's API finder.
I took your code, but changed addrCvtr() to inet_addr() and ran it, and it worked just fine for me. (It gave me a -1 on the connect() call).
So, again, please:a) Verify that AF_INET, SOCK_STREAM and IPPROTO_IP are set to the correct values.
b) Tell us what addrCvtr() is.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.