|
For example
GetLastError()==ERROR_IO_PENDING
WSAGetLastError()==WSA_IO_PENDING
Which one should I use in socket programming?
|
|
|
|
|
followait wrote: Which one should I use in socket programming?
WSAGetLastError , since it is Windows Sockets 2 specific.
Maxwell Chen
|
|
|
|
|
followait wrote:
Which one should I use in socket programming?
Theoretically speaking, when using sockets, you should use the WSA calls. Practically speaking, they end up going to the same place (that is, WSAGetLastError simply returns the a call to GetLastError and the WSA values are pretty much the same as their normal win32 API equivalents). You should NOT assume that will always be the case, however.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Do you mean, practically, I could use either one?
But the two MACRO for error no. is differenct.
|
|
|
|
|
followait wrote: Do you mean, practically, I could use either one?
Yes, practically, you could use either one (at the moment). However, if Microsoft decides to change the behavior of WSAGetLastError, you'd be up the creek if you used GetLastError instead. While there isn't a high probability of that, in practice you should use WSAGetLastError when dealing with sockets. Not to mention that it makes your code consistent with the other socket calls (for someone else trying to read your code).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I see
win32
#define WSA_IO_PENDING (ERROR_IO_PENDING)
win16
#define wSA_IO_PENDING (WSAEWOULDBLOCK)
|
|
|
|
|
I m using list class in one of my classes in a project but getting this compile time error.
Compiling...
IvrNodeManager.cpp
f:\laeeq\ivr\ivr project\advivr\ivractions.h(35) : error C2143: syntax error : missing ';' before '<'
f:\laeeq\ivr\ivr project\advivr\ivractions.h(35) : error C2501: 'list' : missing storage-class or type specifiers
f:\laeeq\ivr\ivr project\advivr\ivractions.h(35) : error C2059: syntax error : '<'
f:\laeeq\ivr\ivr project\advivr\ivractions.h(35) : error C2238: unexpected token(s) preceding ';'
f:\laeeq\ivr\ivr project\advivr\ivrnodemanager.cpp(14) : error C2065: 'list' : undeclared identifier
f:\laeeq\ivr\ivr project\advivr\ivrnodemanager.cpp(14) : error C2059: syntax error : '>'
f:\laeeq\ivr\ivr project\advivr\ivrnodemanager.cpp(14) : error C2039: 'iterator' : is not a member of '`global namespace''
f:\laeeq\ivr\ivr project\advivr\ivrnodemanager.cpp(15) : error C2065: 'listIterat' : undeclared identifier
f:\laeeq\ivr\ivr project\advivr\ivrnodemanager.cpp(15) : error C2039: 'end' : is not a member of 'CList<class civraction,class="" civraction="" &="">'
f:\laeeq\ivr\ivr project\advivr\ivrnodemanager.cpp(15) : fatal error C1903: unable to recover from previous error(s); stopping compilation
here is the code of class CIVRNodeManager which is in ivrnodemanager.h
//////////////////////// ivrnodemanager.h ///////////////////
#include <list>#include "afxtempl.h"
#include <list>#include "DigitActions.h"
#include <string>
using namespace std;
class CIVRAction
{
public:
CIVRAction();
~CIVRAction();
private:
CString m_strName;
CString m_strType;
CString m_iID;
CString m_strActionIDOnSuccess;
CString m_strActionIDOnFaile;
CString m_strActionIDOnTimeout;
CString m_strActionIDOnMaxRetries;
public:
list <cdigitactions*> m_lstDigitActions;
////////////////////////////////////////////////
CDigitActions is a class which is already compiled
Cyber Friend
|
|
|
|
|
Some < and > are missing. Would you please modify the post by check the "Ignore HTML tags ..." ?
Maxwell Chen
|
|
|
|
|
sorry actually this line is causing problem
list <cdigitactions*> m_lstDigitActions;
I will be thankful if any one helps.
Cyber Friend
|
|
|
|
|
sorry this line is causing problems
list <CDigitActions*> m_lstDigitActions;
Cyber Friend
|
|
|
|
|
Cyber Friend wrote: list <cdigitactions*> m_lstDigitActions;
Can you add one include:
#include "stdafx.h" And move #include <list> below the line #include "stdafx.h" ?
Maxwell Chen
|
|
|
|
|
Yes i have done that but errors r still there
Cyber Friend
|
|
|
|
|
Can you please post the content of code again by ignoring HTML tags for more clearer about < and > ?! Thanks!
Maxwell Chen
|
|
|
|
|
Here is updated code after addition of stdafx.h
///////////////// //////////////////////////////////////////////////
#include "stdafx.h"
#include <list>#include "afxtempl.h"
#include "DigitActions.h"
#include <string>
using namespace std;
class CIVRAction
{
public:
CIVRAction();
~CIVRAction();
private:
CString m_strName;
CString m_strType;
CString m_iID;
CString m_strActionIDOnSuccess;
CString m_strActionIDOnFaile;
CString m_strActionIDOnTimeout;
CString m_strActionIDOnMaxRetries;
public:
list <CDigitActions*> m_lstDigitActions;
Cyber Friend
|
|
|
|
|
Cyber Friend wrote: Here is updated code after addition of stdafx.h
And problem's still there?!
Hmm... It looks ok to me...
Would you please include this way:
#include "stdafx.h"
#include "afxtempl.h"
#include "DigitActions.h"
#include <list>
#include <string> And change the line as below to explicitly specify the scope.
std::list <CDigitActions*> m_lstDigitActions;
Maxwell Chen
|
|
|
|
|
Hi all,
Thanx to all of u for help. I have solved the problem by including "StdAfx.h" into ivrnodemanager.cpp which was using ivractions.h.
Thanx
Cyeber Friend
|
|
|
|
|
Do you have the following in your project's stdafx.h file:
#include <list>
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
DavidCrow wrote: #include <list>
I checked the source of the webpage by [View Source] of IE6. There is #include <list> .
Maxwell Chen
|
|
|
|
|
Yes, I know it's there, but I can't update my post to reflect that.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
DavidCrow wrote: but I can't update my post to reflect that
Some ones were also discussing this issue in the Lounge about updating (modification) the posts couple hours ago.
Maxwell Chen
|
|
|
|
|
Hi,
I wish to track what Processes have been executed ie, When the Process is started, finished, memory usage...I don't want to use any tools...Is there any Api call for getting this info or else please suggest me where I get the source code for generating Process log...
Regards,
nag.
|
|
|
|
|
nagamohan_p wrote: I don't want to use any tools...
So what exactly does this mean?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
nagamohan_p wrote: When the Process is started, finished, memory usage...I don't want to use any tools...Is there any Api call for getting this info or else please suggest me where I get the source code for generating Process log...
there are lot of api to accompish same!, i.e. for process :- look for Process32First,Process32Next api.
for Memory Usage:- look for GetMemoryStatus!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Hi,
sorry guys, for delay replying and I'm thankful for ur prompt responses.
> I don't want to use any tools...
It means, any third party tools ie, exe shouldn't be called from my application.The functionality should be incorporated in my application.
I can use these Process32First,Process32Next calls, but these should be written in service and should be called for every second which is burdon..
I wish to write the info in a log when the process is started and when it is stopped...This functionality is seen in "Process Logger"
Please sugget me where to get the info for this functionality..
Regards,
nag.
|
|
|
|