Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Unload ClientFactory?
 Post subject: Unload ClientFactory? Post rating: 0   New post Posted: Fri 03 Jun, 2011, 08:01 

User rating: -
I'm coding an application in C# with the JForex API imported using IKVM. I've noticed that once my code connects using this kind of thing:
        private void btnConnect_Click( object sender, EventArgs e )
        {
            Client = ClientFactory.getDefaultInstance();
            slDukascopy = new SystemListener( Client, JForexString, UsernameString, PasswordString );
            Client.setSystemListener( slDukascopy );
            AttemptLogin(); // first login attempt always fails (timeout issue of some sort?)
            btnConnect.Enabled = false;
            btnLogin.Enabled = true;
            btnDisconnect.Enabled = true;
        }

It does not matter what I do, but I cannot get the JForex client to disconnect / unload -- it remains running in the background, passing traffic back and forth to the Dukascopy side, no matter what I do. (The only thing that works to unload the client is Environment.Exit( 0 ); which is a little too drastic...)

I've tried things like:
        private void btnLogout_Click( object sender, EventArgs e )
        {
            Client.connect( null, null, null );
            btnLogin.Enabled = true;
            btnLogout.Enabled = false;
            btnDisconnect.Enabled = true;
        }

and:
        private void btnDisconnect_Click( object sender, EventArgs e )
        {
            Client.setSystemListener( null );
            slDukascopy = null;
            Client = null;
            btnConnect.Enabled = true;
            btnLogin.Enabled = false;
            btnDisconnect.Enabled = false;
        }

but nothing I do is effective to drop the client communication except dumping the environment itself. I'm wondering if anyone has any ideas or knows how to reset the JForex client in code?

thx! t.


 
 Post subject: Re: Unload ClientFactory? Post rating: 0   New post Posted: Fri 03 Jun, 2011, 13:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See the common topic for issues related to using JForex on .Net:
viewtopic.php?f=61&t=23971


 
 Post subject: Re: Unload ClientFactory? Post rating: 0   New post Posted: Fri 03 Jun, 2011, 17:50 

User rating: -
Thanks for the reference to the IKVM thread. That's where I got the info in the first place for compiling JForex to .NET assemblies. (Which is what my project is based on.) There is nothing on that thread about the problem that I've posted here, which is why I've started this new thread, hoping someone else has seen / solved this problem...

thx again! -- hopefully someone else has seen this specific issue and can reply with some relevant info?

(BTW, I'm going to post a new thread with some .NET code samples that implement the Java Callable object in C# to get onto the JForex trading thread from outside of the officially sanctioned Strategy methods (.onTick(), etc.) when I get a few moments. That may be of some use to others doing IKVM/.NET and perhaps someone with more experience may also give some other ideas for doing the same thing...)


 
 Post subject: Re: Unload ClientFactory? Post rating: 0   New post Posted: Sat 04 Jun, 2011, 17:40 

User rating: -
How is the client unloaded then from a standard Java coding environment? I don't really care about the IKVM equivalent as I can probably figure that out myself if I see working Java code.

I've tried to find how to unload the client by referring to the JForex API documentation and I'm not finding anything. I simply want to know how is it done in any environment -- any examples of how it is done would be useful to me.

t.


 
 Post subject: Re: Unload ClientFactory? Post rating: 0   New post Posted: Thu 30 Jun, 2011, 22:02 

User rating: 0
Joined: Wed 18 May, 2011, 13:28
Posts: 3
Location: CH
I would like to know too how you unload resp. disconnect the connection. Is there any way for standalone Applications? Because I cannot close my application written in Java with JForex after connection is made, to many Threads block the shutdown process :roll:


 
 Post subject: Re: Unload ClientFactory? Post rating: 0   New post Posted: Mon 04 Jul, 2011, 17:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please refer to the common topic for issues related to using JForex on .Net:
viewtopic.php?f=61&t=23971


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com