Struct sockaddr, sin_family is not a member
Posted
by
leon22
on Stack Overflow
See other posts from Stack Overflow
or by leon22
Published on 2012-10-24T10:59:18Z
Indexed on
2012/10/24
11:00 UTC
Read the original article
Hit count: 248
According to this article from msdn ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms740496(v=vs.85).aspx) the struct varies depending on which protocol is selected!
Now I want to use this code from http://www.intelliproject.net/articles/showArticle/index/check_tcp_udp_port to check if a port is open or not!
Now I have the struct sockaddr as follows:
struct sockaddr {
ushort sa_family;
char sa_data[14];
};
but need this strcuture:
struct sockaddr {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
Which changes are necessary?
(Ws2_32.lib is linked and following includes
#define WIN32_LEAN_AND_MEAN
// sockets
#include "windows.h"
#include <winsock2.h>
#include <ws2tcpip.h>
Thx
© Stack Overflow or respective owner