dsn is a dns typo? I'm not sure if this would work as kal attempts to connect directly to an IP, wont this will bypass any local DNS as the ip has already been resolved? (no idea about this though, never done something like this =)
Regarding my method, I'll try clear it up more.
WSAConnect has the following (C) prototype:
int WINAPI WSAConnect(SOCKET s, const struct sockaddr* name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS)
(from the win sdk)
the pararm 'name' contains connection information specific to the the socket type.
The socket type used in this case is AF_INET (internet) so we can cast 'name' from sockaddr* to the sockaddr_in* to access connection info specific to AF_INET connections i.e. IP and port.
And so, through the horrible syntax necessary to set the bytes of the ip address you can do this:
Code:
sockaddr_in* pSockAddr = (sockaddr_in*)name;
pSockAddr->sin_addr.S_un.S_un_b.s_b1 = 127;
pSockAddr->sin_addr.S_un.S_un_b.s_b2 = 0;
pSockAddr->sin_addr.S_un.S_un_b.s_b3 = 0;
pSockAddr->sin_addr.S_un.S_un_b.s_b4 = 1;
and then pass on the parameters to the original WSAConnect function ^^