Socket server is based on FWH 2.6.
The next program is on FWPPC and it cannot communicate with this socket server but it have made connection to any other socket server running on WinXP or Windows Serwer 2003.
Here is e piece of eVC++ code
Code: Select all
BOOL OpenConnectionBtn(HWND hDlg)
{
BOOL nRet=FALSE;
if(WSAStartup(MAKEWORD(2,2), &wsaData))
{
return nRet;
}
strncpy(szRemoteName, "192.168.0.1", sizeof(szRemoteName));
memset(&Hints, 0, sizeof(Hints));
Hints.ai_family = nFamily;
Hints.ai_socktype = nSockType;
if(getaddrinfo(szRemoteName, szPort, &Hints, &AddrInfo))
{
MessageBox(hDlg,L"serwer not found!",L"Error",MB_OK);
return nRet;
}
for(AI = AddrInfo; AI != NULL; AI = AI->ai_next)
{
if((AI->ai_family == AF_INET) || (AI->ai_family == PF_INET6))
{
sock = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol);
if (sock != INVALID_SOCKET)
{
if (AI->ai_socktype == SOCK_STREAM)
{
if(connect(sock, AI->ai_addr, AI->ai_addrlen) == SOCKET_ERROR)
{
closesocket(sock);
continue;
}
nRet = TRUE;
}
break;
}
}
}
if (AI == NULL)
MessageBox(hDlg,L"I cannot connect to any server",L"Error",MB_OK);
return nRet;
}
Regards
Eugeniusz