Click here to Skip to main content
12,244,103 members (55,367 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: TCP/IP
I have the following code that has worked just fine up until Windows 7 (64 bit addressing):

int                 addr_fam = AF_INET; /* AF_INET6 behaves the same */
int                 socket_type = SOCK_STREAM;
SOCKET              conn_socket;
 
conn_socket = socket(addr_fam, socket_type, 0); /* Open a socket */

Currently, conn_socket is set to -1 and using WSAGetLastError() and FormatMessage I get the message "An invalid argument was supplied".

I have found nothing to suggest that this is all of a sudden an invalid combination of arguments but apparently, at least in my case, it is.

Does anyone have any insight into why this would be the case? Any idea how I can determine which of the 3 arguments the system thinks is invalid?

*** NEW INFO ***
This only occurs in DevStudio while in debug mode. The Release version of the code still works OK.
Posted 27-Jun-12 11:47am
Edited 27-Jun-12 14:42pm
v2
Comments
Wes Aday 27-Jun-12 17:57pm
   
Try replacing the 0 with IPPROTO_TCP
tom_delorenzo 27-Jun-12 18:41pm
   
Unfortunately, I get the same result when IPPROTO_TCP replaces the 0 as 3rd argument to socket.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 27 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100