Hi, I have this little part of code: char* echoReply = new char[1024]; int nRet; int nAddrLen = sizeof(struct sockaddr_in); sockaddr_in lpsaFrom; lpsaFrom.sin_family = AF_INET; lpsaFrom.sin_port = 0; // Recieve the echo reply nRet = recvfrom(s, (char*) &echoReply, 1024, 0, (sockaddr*) &lpsaFrom, &nAddrLen); if (nRet == SOCKET_ERROR) int error = WSAGetLastError();
nRet (the return value of recvfrom) is 0xffffffff (SOCKET_ERROR) but WSAGetLastError returns 0 (no error). how can this be? I don't think this is possible. can anybody help me, please? Thx CND
CND
Posts
-
recvfrom returns SOCKET_ERROR but WSAGetLastError returns 0 -
Create nonblocking socket for all win versionsHi, how can I create a nonblocking socket for all windows versions (not only 2k and XP). WSPEventSelect and his friend does not work on win9x... Thx for your help CND
-
CWinThread exits when calling recvfromHi, I'm using a CWinThread to send and recieve ICMP packets (pings). but while recieving the echo replys the thread exits. Thats the code I'm calling:
char* echoReply = new char[50]; int nRet; int nAddrLen = sizeof(struct sockaddr_in); sockaddr_in lpsaFrom; lpsaFrom.sin_family = AF_INET; lpsaFrom.sin_port = 0; lpsaFrom.sin_addr.s_addr = inet_addr("192.168.6.100"); // Recieve the echo reply nRet = recvfrom(s, echoReply, sizeof(echoReply), 0, (sockaddr*) &lpsaFrom, &nAddrLen);
when calling recvfrom() the thread breaks down. even the debugger does not stop at any breakpoints i have set after the recvfrom call. has anybody an idea? PS: recv also doesn't work and bind works fine... -
Import a class from .DLLok, but so I which manner can I use DLLs? Is it possible to load dynamicly a class. so to use IDEA.DLL if the user selects this DLL and AES.DLL if he selects this one. This I important for me, because, I want to add crypto algorithms step by step, like plugins...
-
Import a class from .DLLHi, I'm exporting this class form a dll:
#ifndef _DLL_H_ #define _DLL_H_ #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) #else /* Not BUILDING_DLL */ # define DLLIMPORT __declspec (dllimport) #endif /* Not BUILDING_DLL */ class DLLIMPORT AES { public: AES(); virtual ~AES(void); private: }; #endif /* _DLL_H_ */
and this is the programm, that uses this dll:#include #include #include "..\AES\dll.h" using namespace std; int main(int argc, char *argv[]) { // Load Libary HMODULE AESLibary = LoadLibrary("../AES/AES.dll"); if (AESLibary) printf("AES.DLL found!\r\n"); else printf("AES.DLL not found!\r\n"); AES myAES; system("PAUSE"); return 0; }
but everytime I compile this program I get these errors:[Linker error] undefined reference to `AES::AES()' [Linker error] undefined reference to `AES::~AES()'
(generating the .dll file is no problem...) can anybody tell me why? thx CND