Discussion:
socket() returns error 10022
(too old to reply)
DaveMo
2007-07-22 15:22:19 UTC
Permalink
Hello,

I'm trying to run some older code that works fine on XP on Vista.

I am running the code from a command prompt running as Administrator.
The following is the code that is failing:

sockListen = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET == sockListen) {
fprintf (stderr, "Failed to create socket: %u\n", GetLastError
());
return(FALSE);
}


This code returns error 10022 - Invalid Parameter.

Is there some special privilage needed in Vista to create a socket?
Some other problem maybe?

Thanks,
Dave
Arkady Frenkel
2007-07-28 08:41:30 UTC
Permalink
No admin rigths needed in Vista, maybe WSAStartup() disappeared , just a
hint. OTOH try to remove UAC and check in that case
Arkady
Post by DaveMo
Hello,
I'm trying to run some older code that works fine on XP on Vista.
I am running the code from a command prompt running as Administrator.
sockListen = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET == sockListen) {
fprintf (stderr, "Failed to create socket: %u\n", GetLastError
());
return(FALSE);
}
This code returns error 10022 - Invalid Parameter.
Is there some special privilage needed in Vista to create a socket?
Some other problem maybe?
Thanks,
Dave
Roger Hunen
2007-07-28 09:09:10 UTC
Permalink
Post by DaveMo
I'm trying to run some older code that works fine on XP on Vista.
I am running the code from a command prompt running as Administrator.
sockListen = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET == sockListen) {
fprintf (stderr, "Failed to create socket: %u\n", GetLastError
());
return(FALSE);
}
This code returns error 10022 - Invalid Parameter.
Use 0 instead of IPPROTO_TCP as the third parameter in the socket call.

IPPROTO_TCP (defined as 6 in winsock2.h) has never worked for me.
This totally contradicts the Microsoft docs, but it was the only way for me
to get it work (on XP!).

Regards,
-Roger
--
E-mail: ***@xs4all.nl
Home: http://www.xs4all.nl/~rhunen
ADSL: http://adsl.hunen.net
DaveMo
2007-08-01 01:35:53 UTC
Permalink
Post by Roger Hunen
Post by DaveMo
I'm trying to run some older code that works fine on XP on Vista.
I am running the code from a command prompt running as Administrator.
sockListen = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET == sockListen) {
fprintf (stderr, "Failed to create socket: %u\n", GetLastError
());
return(FALSE);
}
This code returns error 10022 - Invalid Parameter.
Use 0 instead of IPPROTO_TCP as the third parameter in the socket call.
IPPROTO_TCP (defined as 6 in winsock2.h) has never worked for me.
This totally contradicts the Microsoft docs, but it was the only way for me
to get it work (on XP!).
Regards,
-Roger
--
Home:http://www.xs4all.nl/~rhunen
ADSL:http://adsl.hunen.net
Thanks! That did the trick!

Dave

Loading...