Jump to content


Photo

Messages being lost


  • Please log in to reply
2 replies to this topic

#1 pro510

pro510
  • Members
  • 33 posts

Posted 05 January 2006 - 02:39 PM

I have a CWinThread (MFC) derived thread which has a message queue. Whenever the thread uses the ftp library, messages posted to that thread during that time are lost and do not get handled by the thread.

Could it be that the ftp library is handling the messages and maybe we use message id's in the same range?

Any ideas?

Thanks,
Graham

#2 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 05 January 2006 - 03:11 PM

Please be more specific on how your application is designed.

You may want to try to set the UseMessageLoop property of the FTPConnectionMTA class to VARIANT_TRUE (default for FTPConnectionMTA is VARIANT_FALSE). But we recommend to use a separate thread for FTP operations.

The basic scheme would look like this:

CMainThread : public CWinThread
- Creates CFTPThread on Init
- Sends a thread message to the CFTPThread whenever a FTP function should be performed

CFTPThread : public CWinThread
- Calls FTP function e.g. FTPConnectionMTA->Connect().
During this operation the thread messages sent to CFTPThread are queued and executed after the execution of the previous thread message has been completed.
- To abort a FTP operation, call the FTPConnectionMTA->Abort() function directly from the CMainThread.

Remark: In this case the UseMessageLoop property doesn't need to be set to VARIANT_TRUE.

I hope this gives you an idea how to implement it. If not I will try to find some time to extract the relevant code from the SmartFTP Client.

Regards,
-Mat

#3 pro510

pro510
  • Members
  • 33 posts

Posted 06 January 2006 - 11:25 AM

I have a small test application written in VC++ 2003 which I can send you, that exhibits this condition.

Graham




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users