When compiling the below code I get the following errors:
1>c:\users\craig\documents\visual studio 2008\projects\winsock\winsock\main.cpp(29) : error C2228: left of '.sin_family' must have class/struct/union
1> type is 'sockaddr_in *'
1> did you intend to use '->' instead?
1>c:\users\craig\documents\visual studio 2008\projects\winsock\winsock\main.cpp(30) : error C2228: left of '.sin_addr' must have class/struct/union
1> type is 'sockaddr_in *'
1> did you intend to use '->' instead?
1>c:\users\craig\documents\visual studio 2008\projects\winsock\winsock\main.cpp(30) : error C2228: left of '.S_un' must have class/struct/union
1>c:\users\craig\documents\visual studio 2008\projects\winsock\winsock\main.cpp(30) : error C2228: left of '.S_addr' must have class/struct/union
1>c:\users\craig\documents\visual studio 2008\projects\winsock\winsock\main.cpp(31) : error C2228: left of '.sin_port' must have class/struct/union
1> type is 'sockaddr_in *'
1> did you intend to use '->' instead?
Any help is greatly appreciated! Thanks in advance.
EDIT: I'm using MSVC++ Express 2008, with Windows Vista.
You have defined ServerInfo as a POINTER in line 9 but using the . (dot) access in line 28,29 and 30.
You should either:
1. remove the pointer bit from line 9 and have struct sockaddr_in ServerInfo;
2. leave line 9 as it is and use -> instead of the . lines 28, 29 and 30.
Changing line 9 will be easiest as this will also automatically cure the problem in line 31.