|
Well, if i don´t put nothing in onConnection, it´ll work fine.
but the OnRecive method never is called, Then, i can´t process it.
moreover, the client only can send 5 messages.
|
|
|
|
|
Ummm... you have to call accept anyway, what's wrong with your code is not that, but the fact that the socket you use for accepting goes out of scope before its time has come.
Try dynamically allocating the socket as in
SurSocket2* ps=new SurSocket2;
Accept(*ps); This will probably work, though it generates leaks (no one deletes ps ). It is your job to implement some mechanism to track the accepted sockets and delete them when appropriate.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It doesn´t work too. The client can connect and send the message whitout any error. But when i´m debuging the server , the Onconnect and OnRecive are never called.... The Client application work very well.
|
|
|
|
|
Ok, try issuing ps->AsyncSelect(FD_READ|FD_CLOSE); after accepting.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sory Joaquin. but it doesn´t work too.(Pero sigue sin funcionar)
I can´t understand how can the client connect and send the message(only 5) if the server doesn´t accept the connection request?
Can it be a problem with events and messages in the main windows? should i define a windows partner ?
I´ll continue trying.
Anyway. Thank you very much
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Everything was my mistake. because i had to overwrite OnAccept Method, not the OnConnect method.
I´m very stupid, sorry;P
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
If I put pragma once in all my .h files that is sufficient to prevent any include multile definition problems right? Is this the same thing as doing #ifndef #define #endif that we see in the MFC .h generated files? If so , pragma once is much easier, so why isnt that used by t he Class wizard instead of the ifndef stuff?
Appreciate your help,
ns
|
|
|
|
|
|
As you say, both alternatives are equivalent. #pragma once , on the other hand, is not standard C or C++, so in general I prefer the #ifndef guard. As MS guys usually don't bother about standard compliance, I guess they don't use #pragma once only for historical reasons.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I shall start using pragma since upto now I didnt do any guard at all....leading to dreaded multiple include issues...
Appreciate your help,
ns
|
|
|
|
|
I have VS.NET, and much to my dismay, I found that it does not install on Windows 98. However, I can install remote debugging components. I expect, then, that if a process is running on that machine, and I have the remote debugging components installed, I can connect to it from my Windows XP machine running VS.NET and do some debugging.
But all I get is an error saying that the remote computer cannot be found. I can get to it other ways (ping, Network Neighborhood, etc.) To add insult to injury, I can even browse for it, pick it, and it *still* says it can't be found!
What's going on? How can I debug on 98? All I am doing is straight C++ here, on fancy .NET framework or managed code.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
|
What is the risk?
None, static_cast does not rely on RTTI.
Is there any impact on performance?
Sure, dynamic_cast is more costly.
Should I release a new version with RTTI and dynamic_cast to prevent any potential problems?
Depends on your code. If there's a chance that dynamic_cast can fail (i.e. return 0) and you were using static_cast , then your app is buggy. If not, no need to switch to dynamic_cast anyway
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Hello.
Does MS Access support BatchUpdates?
I have a project in which im using following code but it gives me an error when there is
more than 2 records in the recordset which have been changed
IDispatch error # 3156 :Number of rows with pending changes exceeds the limit.
<br />
_variant_t v(m_pProject->m_ptrConnection.GetInterfacePtr());<br />
<br />
m_pRstBugs->CursorType = adOpenKeyset;<br />
m_pRstBugs->LockType = adLockBatchOptimistic;<br />
m_pRstBugs->Open((LPCTSTR)ProjectName, v,<br />
adOpenKeyset,adLockBatchOptimistic,adCmdTableDirect);<br />
<br />
if (m_pRstBugs->Supports(adIndex) && m_pRstBugs->Supports(adSeek))<br />
{<br />
m_pRstBugs->Index = DBtags::m_sProjectIndexName;<br />
}<br />
<br />
<br />
m_pRstBugs->MoveFirst();<br />
while(!m_pRstBugs->adoEOF)<br />
{<br />
_variant_t x("test");<br />
m_pRstBugs->Fields->Item["description"]->Value = x;<br />
m_pRstBugs->MoveNext();<br />
}<br />
m_pRstBugs->UpdateBatch(adAffectAll);<br />
<br />
|
|
|
|
|
I'm not sure how many changes are supported, but I think(!) the Jet Database Engine only supports 1. You might want to check out the "Maximum Pending Rows" property of your RecordSet object before making any changes.
The article for the property is on MSDN at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adosql/adoprg04_9cop.asp
RageInTheMachine9532
|
|
|
|
|
Does anybody know how I would enumerate LAN connections and disconnect them. I know you can do this with the RAS API for dial-up connections but I am not sure if it works with LAN connection
Thanks
Ceri
|
|
|
|
|
Hello,
i am using a CStdioFile object to read in a text-file. On some positions within the file i have to seek. I do it like this:
CString line;
CStdioFile file;
...
/* Read a few lines */
while (condition) {
file.ReadString(line)
/* do something with line */
}
/* Save current start-position for new line */
DWORD pos = file.GetPosition();
/* Read a few lines */
while (condition) {
file.ReadString(line)
/* do something with line */
}
/* Go back to saved position */
file.Seek(pos,CFile::begin);
Positioning the file-pointer by using the seek-method works only correct, if every line has a 0A 0D at the end. Now i have to parse a file that only has 0A at the end and the seek-method fails. It sets the file-pointer to the middle of a line and not to the beginning of the expected line. Please help!
Best regards
tabor25
|
|
|
|
|
Do you know whether ReadString() appends or overwrite previous data in a CString object?
Kuphryn
|
|
|
|
|
Hello Kuphryn,
ReadString() overwrites the previous data in the Cstring object.
Best regards
tabor25
|
|
|
|
|
Hi, I have a whindow which is currently minimized, now for some particular reason I must set it to be a foreground window for a short moment, but I do not want the user to see it. So the best way to do so, I guess, is to restore the window then immediately move it off screen(e.g., call "::MoveWindow" and give it a CRect(-999, -999, 100, 100), or something like that).
Now the problem is that, since calling "::MoveWindow" while the window is minimized has NOT effect, I must first restore the window by calling "ShowWindow(hwnd, SW_RESTORE)", at that time, before it gets moved off screen, the window displays on screen for one second or two, and that will annoy my user.
So, is there anyway I can move a previously minimized window off screen without letting it show on the visible screen area at all? Thanks.
|
|
|
|
|
And the following :
Hide -> Restore -> Move -> Show ? Cn you hide it while it is minimized ?
~RaGE();
|
|
|
|
|
Since SW_RESTORE will display the window regardless of its previous state.
|
|
|
|
|
Hi !
I have programmed a visual c++ add-in, which runs fine on all our visual c++'s but one, which throws the error : add-in cannot be registered because DllRegisterServer() fails. Add-in will not be loaded again. (Merely translated from German ).
There is no memory error, registry can be accessed, so any idea of what could be the problem ?
Platform is WinNT 4.0 SP 5.0, Visual C++ 6.0.
~RaGE();
|
|
|
|
|
use depends.exe to check if some of the dlls needed by add-in are missing
|
|
|
|