Strange things with parameters.
-
There is surely something I do not understand here. I would very much appreciate if someone could explain to me how I screwed this up. Thank you. --------------------Configuration: TCPIPwatch - Win32 Debug-------------------- Compiling... TCPIPwatchDlg.cpp C:\DOCUMENTS AND SETTINGS\ADMIN\DESKTOP\SSPROJECT\TCPIPwatch\TCPIPwatchDlg.cpp(235) : error C2664: 'bind' : cannot convert parameter 2 from 'struct CTCPIPwatchDlg::TCPIPWConnectSock::SOCKADDR_IN *' to 'const struct sockaddr *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. TCPIPwatch.exe - 1 error(s), 0 warning(s) void CTCPIPwatchDlg::TCPIPWConnectSock(SOCKADDR_IN *dest, SOCKET &theTrgSock) { dest->sin_family = AF_INET; dest->sin_port = 80; if(dest->sin_port == INVALID_SOCKET) AfxMessageBox("Port is invalid.",MB_OK); theTrgSock = socket(AF_INET, SOCK_RAW, IPPROTO_IP); const char RCVTIMEO[50] = "5000"; setsockopt(theTrgSock, SOL_SOCKET, SO_RCVTIMEO, (RCVTIMEO), 4); bind(theTrgSock, (struct SOCKADDR_IN*) dest, sizeof(dest)); }
-
There is surely something I do not understand here. I would very much appreciate if someone could explain to me how I screwed this up. Thank you. --------------------Configuration: TCPIPwatch - Win32 Debug-------------------- Compiling... TCPIPwatchDlg.cpp C:\DOCUMENTS AND SETTINGS\ADMIN\DESKTOP\SSPROJECT\TCPIPwatch\TCPIPwatchDlg.cpp(235) : error C2664: 'bind' : cannot convert parameter 2 from 'struct CTCPIPwatchDlg::TCPIPWConnectSock::SOCKADDR_IN *' to 'const struct sockaddr *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. TCPIPwatch.exe - 1 error(s), 0 warning(s) void CTCPIPwatchDlg::TCPIPWConnectSock(SOCKADDR_IN *dest, SOCKET &theTrgSock) { dest->sin_family = AF_INET; dest->sin_port = 80; if(dest->sin_port == INVALID_SOCKET) AfxMessageBox("Port is invalid.",MB_OK); theTrgSock = socket(AF_INET, SOCK_RAW, IPPROTO_IP); const char RCVTIMEO[50] = "5000"; setsockopt(theTrgSock, SOL_SOCKET, SO_RCVTIMEO, (RCVTIMEO), 4); bind(theTrgSock, (struct SOCKADDR_IN*) dest, sizeof(dest)); }
Hi, typecast with (const ::SOCKADDR*) to 2nd parameter for function bind(). Cheers:) The chosen One :)