I have
#include <sys/socket.h>
recvfrom(s, dgram, sizeof(dgram), size, (struct sockaddr*)&adr, &x);
I receive no matching function for call to recvfrom in iOS. but Xocde does show the prototype
recvfrom(int, void*, size_t, int, struct sockaddr *, socklen_t*)
So, Why does Xcode give no matching function error on recvfrom?
It is likely that one of the arguments is of an incorrect type. Try compiling the code through your terminal with gcc for better error messages. For some reason Xcode is really vague about this one.
Make sure that the x in your 6th argument &x
is an 'socklen_t *' (aka 'unsigned int *'), not an int. That's what caused me to get this error.
Use socklen_t for x
socklen_t x = sizeof(servaddr);
uint8_t buffer[1024];
long nBytes =
recvfrom(socket, buffer, 1024, 0, (struct sockaddr *) &servaddr, &x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With