Link to home
Start Free TrialLog in
Avatar of vinawy
vinawyFlag for Singapore

asked on

Winsock Error 10014 (C++ Programming)

Hi experts,

I keep receiving error code 10014 whenever my code runs recvfrom() in an finite while loop. I know that this error have something do with the following:

WSAEFAULT
(10014)
Bad address.
The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument which is a struct sockaddr is smaller than sizeof(struct sockaddr).

But, I cant figure out whats wrong. Pls advice. Tks

Btw, My BUFFER_SIZE is 80028 but i doubt it has anything to do with the pointers.


memset((void *)&server, 0, sizeof(struct sockaddr_in));
..
..
..
..
bytes_received = recvfrom(sd, buffer, BUFFER_SIZE, 0, (struct sockaddr *)&client, &sender_length);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial