CAsyncSocket()::OnReceive() will not be fired !!! -> MFC BUG ?!?

Hello peoples

i have wrotten a FTP-Client with a own Class of CAsyncSocket. Sometime the messagge from the Server will NOT BE reveiced, but the server have ben sendet to the Client ( the OnReceive() of the Client is not called !!)
I use MSVS6.0

OR can´t use the CAsyncSocket for a FTP-Client ? ( the CInternetConnetion can´t use, why i  need ALL sended and received data for displaying

regard
Nico van Halobar


0
anonymous (74722)
6/3/2004 11:46:04 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
680 Views

Similar Articles

[PageSpeed] 15

Nico van Halobard wrote:

> Hello peoples,
> 
> i have wrotten a FTP-Client with a own Class of CAsyncSocket. Sometime the messagge from the Server will NOT BE reveiced, but the server have ben sendet to the Client ( the OnReceive() of the Client is not called !!) 
> I use MSVS6.0.
> 
> OR can´t use the CAsyncSocket for a FTP-Client ? ( the CInternetConnetion can´t use, why i  need ALL sended and received data for displaying)
> 
> regards
> Nico van Halobard
> 
> 

CAsyncSocket::OnReceive is capable of operating very reliably.  We can 
only guess what is wrong in your program.

Do you call Receive one and only one time every time OnReceive is called?

Do you check the return value from Receive?  One common error is to 
assume that it will always equal the sent message size.  But the number 
of bytes received when you call Receive can be any number: You must 
reassemble the sent messages using the number of bytes that you get.

Another possible cause is: While your program is executing a loop 
OnReceive will not be called.  OnReceive is a message handler, so your 
program must be pumping messages in order to receive this call.

-- 
Scott McPhillips [VC++ MVP]

0
scottmcp8856 (490)
6/3/2004 1:08:30 PM
Nico van Halobard wrote:
> thx 4 reply
> 
> but i have no loop in my programm. the programm react of the OnReceive() Messgae Only.
> If this fired then i read the data form the socket.
> 
> hmmm but how can i pump any messgae to the UIThread WHEN THE THREAD is waiting for any msg. ONLY?
> 
> regards
> Nico van Halobard

If you are using a CWinThread then it provides the required message 
pump.  All you have to do is return to MFC and the built-in message pump 
will cause OnReceive to be called the next time a message arrives.

Also note that if the CAsyncSocket is used in a UI thread then the 
socket must be created in that same thread, or Detach and Attach must be 
used to "move" the socket into the thread.

-- 
Scott McPhillips [VC++ MVP]

0
scottmcp8856 (490)
6/3/2004 11:28:20 PM
i have all this done.! IT IS A BUG OF MFC 6.0 !!!
I have built one MSVS2002.NET and all is running fine!

regards
Nico van Halobard


0
anonymous (74722)
6/4/2004 5:31:02 AM
Reply:

Similar Artilces:

Excel Chart Problem!!! (Bug I think)
This is a multi-part message in MIME format. ------=_NextPart_000_00B9_01C93A2D.3C166610 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Try the folloing. 1. Open Excel. 2. Paste the following data A B C D E F=20 2008 10 20 30 40 0 10=20 3. Menu Insert/Pie (select the first Pie type) 4. Right Click one of the top of any part of the circle/Format Data = Series 5. Click Shadow and move any of the slides on the right.=20 See what happend on the chart. The problem is that the ZERO generates a full circle and you can drag = and ...

Windows 7 bug
Does any one know of a windows 7 newsgroup that deals with keyboard bugs. I have an intermittent problem with my keyboard since upgrading to Win 7. I will be able to type fine and then the keyboard becomes garbled. If I type an "A" another character appears. It goes away when I reboot only to re-appear later. Have no idea what is going on.......JFidler In article <08A46189-44C6-4325-B794-610FB28E0586@microsoft.com>, "Jane Fidler" <jgfidler@neo.rr.com> wrote: > Does any one know of a windows 7 newsgroup that deals with keyboard bugs. I >...

Using ATL classes in an MFC app?
I am working on an MFC based application that needs to make use of classes that are code in an ATL-based lib. Are there any good tutorials around that explain how to do this? Is there a general approach I can use to wrape/hide the ATL coded classe? At first blush it seems like I can comple the MFC files compile that referencing the ATL-based classes. However at LINK time I get errors like the following: cdromLibWin.lib(CDROMMediaReader.obj) : error LNK2019: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ) referenced in function "public: ...

Commands will not run
I converted from Access 2003 to Access 2007 my previous commands and queries will not run. On Oct 13, 1:10 pm, guycpsi <guyc...@discussions.microsoft.com> wrote: > I converted from Access 2003 to Access 2007 my previous commands and queries > will not run. Access 2007 will disable your code if the source file of your DB is not in a "Trusted" location. If you click the Office button in the upper left corner, then go to Access Options, you should be able to add your source file to the trusted locations list. HTH ...

Internet explorer 7 will error and close crm 3.0
What could cause this Under what circumstances does this occur ? If CRM always closes immediately then this due to pop-up blockers, otherwise can you post more information about the error and when it occurs -- David Jennaway - Microsoft Dynamics CRM MVP Web: http://www.excitation.co.uk "Mark" wrote: > What could cause this ...

Bug in Physical Inventory Import Procedure
Dear Microsoft. I am using the Phsycial Inventory Procedure and found that there is bug in the program of import procedure. This bug I have found and gone through using SQL Profile, what I investigate is the import procedure defined by you is have collaion error: Server: Msg 446, Level 16, State 9, Line 1 Cannot resolve collation conflict for equal to operation. The error is not raising if you not use the temporary table as you are using [##ST_Validation_1]. What I did is that I follow step by step process of SQL profile and create the table [ST_Validation_1] instead of [##ST_Validation...

Assert in DLL that statically links to MFC
I'm developing a DLL that statically links to MFC. I'm getting an assert from AfxGetInstanceHandle when I try to create a CWnd. I've read about AFX_MANAGE_STATE, but because I'm statically linking to MFC, AFX_MANAGE_STATE doesn't do anything (it is #define'd to be empty). I've tried using AfxSetResourceHandle to my DLL's instance handle and this allows me to load resources from my DLL, but AfxGetInstanceHandle still fails when MFC calls it to create a window. I also tried every tip I could find via Google searches, but nothing seemed to work. Is there an...

Memory leak in mfc
Hello, I'm writing an app using VS2005. I'm getting a memory leak in the following code. //----------------------------- //Get the data back (16 bytes) CString dataRead = CReader.GetData(); int i = 0; char docArray[15]; //Take the first 14 bytes out for(i=0; i<14; i++) { docArray[i] = dataRead[i]; } docArray[14] = '\0'; //Get the value on to a CString document = docArray; document.Trim(); memset(docArray, 0, 0); //----------------------------------------- document is a CString declared in the .h file. The leak occurs when I set: document = docArray; Please notic...

Accessing a secure (https) server via MFC WinInet classes.
I am attempting the access a secure (https) server via the MFC WinInet classes and I am having difficulty. I have scoured the newsgroups and the Internet for suggestions, but I have not been able to find anything useful. As the MSDN Knowledgebase suggests, I use CInternetSession, CHttpConnection and CHttpFile to connect to a server and send it a Request. My Visual C++ 6.0 app works fine when I use GetHttpConnection() to get a connection to a non-secure server. However, when I name a secure server (https://...) as the URL, a subsequent call to CHttpFile::SendRequest() always results in an inte...

Putting Text AND Bitmap on MFC dialog
Does anyone have a solution for putting a small icon along with text on an MFC dialog button? With the existing button control it appears it will only do text OR a bitmap - not both. Any thoughts are much appreciated. "Ken" <anonymous@discussions.microsoft.com> wrote in message news:04de01c3d943$6dc13280$a301280a@phx.gbl... > Does anyone have a solution for putting a small icon along > with text on an MFC dialog button? With the existing > button control it appears it will only do text OR a > bitmap - not both. > > Any thoughts are much appreciated. You ...

Will Not Send
I am running Outlook 2003, Windows XP. I have Norton with Worm Blocking turned off. Sometimes Outlook will not send an email. Just sits there. Always if I try to send and get a time out then I can NEVER resend the message. It seems if I delete the message, shut down, and restart the computer then I can resend. Any ideas as to what is going on. Sometimes it works fine. Thanks are you looking in the outbox when this happens? if not, do you have to delete it, will just restarting outlook help, or can you open it and hit resend? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself...

Amnesty for illegal immigrants will not happen this time.....................
Our politicians lead the league in all talk, no action. Is blowing us some sunshine good enough? Read what The Expert thinks: http://www.ExpertHumor.com/ *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

Annoying bugs in Windows 7
I'm running Windows 7 64-bit Home Premium on an Asus P5Q3 motherboard with an Intel Q9550 2.83GHz quad core processor, 4GB of 1800 MHz DDR3 RAM (the memory is not overclocked to 1800 MHz at the moment and runs at 1333 MHz), 80GB Intel Solid State Drive and two Seagate 500GB hard disks in striped data mode (ASUS super speed mode). I love the new windows 7, but it has three annoying faults for me. 1) When the USB bus gets tied up it crashes windows into a reboot, not blue screen of death, this can occur when rebooting the system after a prolonged shutdown period, and also i...

two messages that will not delete...
We are running Exchange 2000 with Outlook 2002 clients. A user has received two email messages that nothing can be done with. If she tries to delete them, an "internal error occurred" message is displayed. Same for forwarding or simply trying to open them... Is there any way I can physically remove user messages on the Exchange server somewhere? Thanks Brad Try OWA. You could also try to Exmerge them out. If those doesn't work you might try running isinteg. -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!" "Brad Pears" ...

Problem with PyRun_SimpleFile and MFC Application
Hello! In have embedded python into my MFC application. It works fine using the PyRun_SimpleString method, giving it a string with some simple commands. When i am using PyRun_SimpleFile instead, my application crashes. I have also created a console application. There i also call PyRun_SimpleFile. The console application executes the given script. My code looks like the following: ********************************** MFC-Application: ********************************** >Py_SetProgramName("testclient"); >/* Initialize the Python interpreter. Required. */ >Py_Initialize();...

How to read binary file created by non-MFC source?
I am a newbie working on a simple project for loading a binary file and displaying its byte-by-byte contents in interger equivalent. The file was created by some unknown source (presummably not MFC). I am using SDI/CScrollView interface and the file is supposed to be open under FILE/OPEN menu. At the beginning, I've been trying to include CString str; ar >> str; in void CMyProjectDoc::Serialize(CArchive &ar) as an attempt to put everything in str prior to converting every byte into interger. What happened was 1) The first byte (which is known to be a 92) was missing; and 2) ...

Attaching CFrameWnd object to existing non-MFC window
Hello! I need to attach CFrameWnd-derived object to existing non-MFC window. The window has quite complex a window procedure. My CFrameWnd-derived object has its own MFC message map which I need to use. So the question is now how to combine the window procedures of both CFrameWnd-derived class and the original window. I subclassed the original non-MFC window, and overloaded the DefWindowProc with sth like: LRESULT CMainFrame::DefWindowProc( UINT message, WPARAM wParam, LPARAM lParam ) { if(m_pfnSuper && m_hWnd) { return(( WNDPROC(m_pfnSuper))(m_hWnd,message,wParam,l...

Writing a huge file with MFC
Does someone have an MFC (of API) code extract that can write a single huge file to disc? (~700Gb). This is just to see if it can be done :-) I've made a few attempts using WriteFile() and __int64 int's but the problems arise becuase WriteFile() args are all (afaic see) 32 bit ints. So it's iompossible to say "write 750000000000 bytes" in the bytecount arg. Even to do it in chuncks of 2Gb might not be possible as the offset in file pointer args is also 32 bits. Just wondered if anyone out there has managed to do this? Thanks I'm not aware of any restrict...

mfc csreen does not refresh
I have a VC6 app that I am trying to develop. It takes a 700 maps and processes each one individually the program is set around one big loop I intend that it should paint all the maps however it just paints the first and the last map at the end of the major loop I have an Invalidate(); UpdateWindow(); it does not force an update except for the first and last map If however I do a Invalidate(); UpdateWindow(); AfxMessageBox("next one",MB_ICONEXCLAMATION|MB_OK); then I can step through each map - not very attractive given there are 700 maps I tried to use Invalidat...

Outlook Email will reecieve but not send
I have Outlook 2002 with WIndows Xp. My email account was working fine a few days ago. Now it will recieve but not send. I checked all my account setting with my ISP and they say its Outlook. Any ideas? JS On Tue, 14 Oct 2003 15:25:12 -0700, "JS" <jerry@creeklife.net> wrote: >I have Outlook 2002 with WIndows Xp. My email account was >working fine a few days ago. Now it will recieve but not >send. I checked all my account setting with my ISP and >they say its Outlook. Any ideas? > > >JS Go into your email accounts (Tools -> Email Accounts) Th...

MFC Dll with dialog
Hi I have MFC Dll with dialog, I used it in C# App. All the function (from App to the Dll ) was at another Thread ("Dll thread"). Not in the main (GUI) thread, but in the same one (using queue) The init(.) and other function first enter to Q and the pulled by the "Dll Thread") It's working functionality, but The MFC Dialog stays grey. (Missing WM_PAINT (? I think that I have problem with window handle. The Code in the C#: [..."MyDll.dll"...] export static int Init(CallBack* xxx, SData* ps); The function get delegate to return event from the DLL and data ...

Outlook 2002 no longer will archive
Hi, I was archiving a 4 GB mailbox by year so as not to exceed the .pst limit and had a need to put all the mail back into the mailbox once I was completed. The first operation when perfectly! Then the putting the mail back went perfectly. When I tried to re-archive the files that is where the problems began... It seems that if you archive files and try to archive them after you put them back into the mailbox they are no longer archivable... WHY? I need to archive this mailbox again because the original archive pst files were lost. Thanks, Scott 4 gig mailboxes are only suppo...

see if message will send
hello hello SOS Hi, Marva. We got your message. Do you have a question? RC -- R. C. White, CPA San Marcos, TX rc@grandecom.net Microsoft Windows MVP Windows Live Mail 2009 (14.0.8089.0726) in Win7 Ultimate x64 "Marva Taylor" <brataylo@bellsouth.net> wrote in message news:OgyVw$ooKHA.5696@TK2MSFTNGP04.phx.gbl... > hello hello SOS sos "Marva Taylor" <brataylo@bellsouth.net> wrote in message news:OgyVw$ooKHA.5696@TK2MSFTNGP04.phx.gbl... > hello hello SOS ...

Weird Parameter Passing Bug
I have the following classes : CTestBase CLogic (virtual class, derived from CTestBase) CScanLogic (derived from CLogic) CBacktestLogic (dervied from CLogic) I instantiate a CScanLogic object which takes 3 CStrings, and a CStringArray as parameters. The prototype looks like this : CScanLogic (CString &x,CString &y,CString &z,CStringArray &a); The members variables are protected variables residing in the CTestBase class. They are CString m_x,m_y,m_z; CStringArray m_a; CScanLogic::CScanLogic (CString &x,CString &y,CString &z,CStringArray &a): CLogic(x,y,z,a...

Excel will not allow me to use the funtion MROUND,
Excel will not allow me to use the funtion MROUND, any ideas I am using the expression =MROUND(10, 3) Hi if you receive a #NAME error you have to activate the Analysis Toolpak Add-in. Goto 'Tools - addins' and check this Addin (you may be asked to insert your installation CD) -- Regards Frank Kabel Frankfurt, Germany Paul D wrote: > Excel will not allow me to use the funtion MROUND, any > ideas > > I am using the expression =MROUND(10, 3) The Analysis Toolpack needs to installed. Tools>Addins> Analysis Toolpack. Bye, Cesar Zapata Paul D wrote: > Exc...