0
BOOL f_WSAConnect(SOCKET s, const sockaddr *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS)
{
    MessageBoxA(NULL, name, "hi", MB_OK | MB_SYSTEMMODAL);
    return WSAConnect(NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}

I'm trying to obtain the ipv4 from const sockaddr when it's passed and i am not sure how i would approach it??

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • Welcome to Stack Overflow. Please take the time to read [The Tour](http://stackoverflow.com/tour) and refer to the material from the [Help Center](http://stackoverflow.com/help/asking) what and how you can ask here. – πάντα ῥεῖ May 26 '17 at 17:23
  • I assume you are asking about the textual representation of ipv4 address? Use `inet_ntop`: http://man7.org/linux/man-pages/man3/inet_ntop.3.html – freakish May 26 '17 at 17:28
  • @freakish from the `WSAConnect` we know this is Windows code and `inet_ntop` might be broken. – Passer By May 26 '17 at 18:55
  • @PasserBy I don't know much about Windows, but a bit googling and it seems that there are equivalents: `InetNtop` or `WSAAddressToString` functions. – freakish May 26 '17 at 20:06
  • @PasserBy Hey, this question was actually properly tagged. We know this is Windows code from the winsock tag. – Daniel H May 30 '17 at 14:24
  • @DanielH Oops, didn't see that :). But that is not my point though :P. Wait, its edited in by Panta Rhei – Passer By May 30 '17 at 14:25
  • @PasserBy Ah, you’re right, I missed that. But yes, it’s not really the point, although I *think* Windows sockets work very similarly to Unix ones. – Daniel H May 30 '17 at 15:39

0 Answers0