Re: [Sqlrelay-discussion] setConnectTimeout() not working correctly?
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2014-01-01 23:23:55
|
Hi Cal,
Interesting... I'll do some tests here, figure out what's happening and
let you know what I find.
Dave
On 12/31/2013 3:08 PM, Cal Heldenbrand wrote:
> Hi David,
>
> I'm attempting to write a weighted round-robin connection method for an
> easy failover mechanism on multiple SQL Relay servers. It appears that
> the C++ sqlrconnection::setConnectTimeout() function isn't behaving like
> I'd expect. It seems that no matter what values I pass to it, the
> connection *always* fails.
>
> Here's the general idea I'm doing:
>
> bool success = false;
> do
> {
> /*
> select random sql relay server
> */
>
> tmpconn = new sqlrconnection(hostname, port, NULL,
> user, pass, 0, 1);
> tmpconn->debugOn();
> tmpconn->setConnectTimeout(10, 5000000);
>
> const char *version = tmpconn->serverVersion();
> printf("version: '%s'\n", version);
> if ( version )
> success = true;
>
> /* Breaking out after a few tries */
> }
> while ( success == false );
>
> Running that, I get something like this:
>
> <pre>
> Connecting to listener...
> </pre>
> <pre>
> Inet socket: 127.0.0.1:9000 <http://127.0.0.1:9000>
> </pre>
> <pre>
> Setting Error
> </pre>
> <pre>
> Couldn't connect to the listener.
> </pre>
> version: '(null)'
>
> But when I comment out the setConnectTimeout() call, it works just fine:
>
> <pre>
> Connecting to listener...
> </pre>
> <pre>
> Inet socket: 127.0.0.1:9000 <http://127.0.0.1:9000>
> </pre>
> <pre>
> Authenticating : ...
> </pre>
> <pre>
> Server Version...
> </pre>
> <pre>
> Checking for error
> </pre>
> <pre>
> No error occurred
> </pre>
> <pre>
> 0.53.1
> </pre>
> version: '0.53.1'
>
> I've played around with different values for seconds and microseconds.
> (I want a timeout of 5 seconds, however that can be accomplished)
>
> Thanks for any help!
>
> --Cal
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>
> _______________________________________________________
> Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
> http://www.doteasy.com
>
>
>
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
>
> _______________________________________________________
> Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
> http://www.doteasy.com
>
|