|
std::list<WSABUF*> m_ListBuf;
m_ListBuf.push_back(pWsabuf); // error, why?
-- modified at 4:03 Thursday 25th May, 2006
|
|
|
|
|
|
the error is at:
iterator insert(iterator _P, const _Ty& _X = _Ty())
{_Nodeptr _S = _P._Mynode();
--> _Acc::_Prev(_S) = _Buynode(_S, _Acc::_Prev(_S));
_S = _Acc::_Prev(_S);
_Acc::_Next(_Acc::_Prev(_S)) = _S;
allocator.construct(&_Acc::_Value(_S), _X);
++_Size;
return (iterator(_S)); }
I declare it in a class
class PerIOData : public OVERLAPPED
{
public:
int m_Operation;
SOCKET m_Socket;
WSABUF *m_pBuf;
int m_BufNum;
int m_NextStart; std::list<wsabuf*> m_ListBuf;
};
use like this, in a thread:
PerIOData *p=new PerIOData
...
p->m_pBuf=new WSABUF;
p->m_pBuf->len=128;
p->m_pBuf->buf=new char[128];
when data is received through IOCP:
p->m_ListBuf.push_back(p->m_pBuf);
|
|
|
|
|
It's my bug.
I write:
memset(p,0,sizeof(*p));
which overwrite the list member. Too careless.
|
|
|
|
|
i have tried with the sample snippet. its working fine for me. check for the error code using GetLastError
std::list<wsabuf*> m_ListBuf;
WSABUF* pWsabuf = new WSABUF;
m_ListBuf.push_back(pWsabuf);
SaRath
|
|
|
|
|
I declare it in a class
class PerIOData : public OVERLAPPED
{
public:
int m_Operation;
SOCKET m_Socket;
WSABUF *m_pBuf;
int m_BufNum;
int m_NextStart; std::list<WSABUF*> m_ListBuf;
};
|
|
|
|
|
It's my bug.
I write:
memset(p,0,sizeof(*p));
which overwrite the list member. Too careless.
|
|
|
|
|
wow, you write for all
this code has one bug or no
std::list<wsabuf> m_ListBuf;
CAnswer *p=new CAnswer;
memset(p,0,sizeof(*p));
p=this;
p->m_pBuf=new WSABUF;
p->m_pBuf->len=128;
p->m_pBuf->buf=new char[128];
p->m_ListBuf.push_back(p->m_pBuf);
whitesky
|
|
|
|
|
I used a wrong memset.
Thank you.
|
|
|
|
|
As said above,
WSABUF* pWsabuf = new WSABUF is necessary.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
I declare it in a class
class PerIOData : public OVERLAPPED
{
public:
int m_Operation;
SOCKET m_Socket;
WSABUF *m_pBuf;
int m_BufNum;
int m_NextStart; std::list<wsabuf*> m_ListBuf;
};
use like this, in a thread:
PerIOData *p=new PerIOData
...
p->m_pBuf=new WSABUF;
p->m_pBuf->len=128;
p->m_pBuf->buf=new char[128];
when data is received through IOCP:
p->m_ListBuf.push_back(p->m_pBuf);
|
|
|
|
|
followait wrote: p->m_pBuf->len=128;
p->m_pBuf->buf=new char[128];
These are the only two things you have inside WSABUF? can you please display the structure of WSABUF ?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
I dont think that new -ing that pointer is necessary.
List will keep whatever the value we are passing in the type specified as template argument.
he may be bugging with some other issues
SaRath
|
|
|
|
|
It's my bug.
I write:
memset(p,0,sizeof(*p));
which overwrite the list member. Too careless.
|
|
|
|
|
Can you be more specific
whitesky
|
|
|
|
|
I declare it in a class
class PerIOData : public OVERLAPPED
{
public:
int m_Operation;
SOCKET m_Socket;
WSABUF *m_pBuf;
int m_BufNum;
int m_NextStart; std::list<WSABUF*> m_ListBuf;
};
use like this, in a thread:
PerIOData *p=new PerIOData
...
p->m_pBuf=new WSABUF;
p->m_pBuf->len=128;
p->m_pBuf->buf=new char[128];
when data is received through IOCP:
p->m_ListBuf.push_back(p->m_pBuf);
|
|
|
|
|
followait,
Do you get runtime error or error you assign values to m_pBuf and then push_back but i dont get any error?
can you show error,please?
whitesky
|
|
|
|
|
I have a MFC application compiled as "Static library". This exe works fine in machines with Visual Studio. But when moved to another PC without Visual Studio ..it doesn't work as supposed to be. No error is throwed.
MFC is compiled " Static Library"..
Pls help what else is missing
Suganya.
|
|
|
|
|
see previous post maybe it is some helpful to you
whitesky
|
|
|
|
|
Check whether there is any dependecies with any other DLL using dependency walker. it is available with Visual Studio.
SaRath
|
|
|
|
|
When you run the application in PC without Visual Studio .. what is the message you are getting.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
When i run the application in PC without Visual Studio,i am not getting any messages.
The Dependencies were verified on the developement pc.all the misssing dll's are moved but still it is not working.
|
|
|
|
|
Are all required DLLs present and registered correctly? Are you using any ActiveX controls?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi Friends,
I have created an EXE File in VC++.The Exe Works fine since i am having VC++ installed in my machine.But i copied the Exe File to another machine where VC++ is not installed,there EXE doesnt work.
What is the reason for that,is there any possibility for it work.
Regards,
Ruban.
|
|
|
|
|
Try creating the exe in release mode..
If that too fail use Dependecny Walker in the other mechine to find the missing dlls
nave
|
|
|
|