codingG 0 Newbie Poster

Hi,

Here is the problem I have encountered :

Scenario :

I am trying to achieve asynchronous messaging between 1 server and X number of clients (on different IPs). As a part of the system in the client, I have used threading for receiving messages :

        thrMessaging = new Thread(new ThreadStart(ReceiveMessages));
        thrMessaging.Name = ("Thread{0}Message");
        thrMessaging.Start();

Once a message is received, it calls the ReceiveMessages function, which subsequently calls the following functions : schedule_Execution() then CreateNewOrderSch(). Keep in mind that I am still running on the new thread - "Thread{0}Message", as part of the CreateNewOrderSch() functions, I was hoping to assign m_instr (variable defined in the namespace) to a profile attribute. This is the point I have encountered the error (Error code received : Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

TTOrderProfile profile = new TTOrderProfile();  
profile.Instrument = m_instr;

Def

namespace TT_MEAPI
{
    /// <summary>
    /// Main form: Inherit all the MEAPI classes
    /// </summary>
    public partial class frmTTMeapi : Form,
                                      ITTMarketExplorerEvents,
                                      ITTGatewayEvents,
                                      ITTProductEvents
    {
private TTInstrObj m_instr = null;

//code omitted
}

Comment:

I think the error is trying to tell me that I can refer to the m_instr object as it was not defined in the Thread{0}Message thread, was wondering if you please give me some advice on this?

Also, please keep in mind that the TTOrderProfile obj is in a ref DLL that is written in C++, I was advised that this error is usually an interop between a COM obj(unmanaged) and.Net program(managed)?

Any suggestions would be highly appreciated, thanks!