Flex RemoteObject timeouts?

2019-08-12 14:10发布

问题:

I've been tinkering around with Flex RemoteObjects, and I've found that they aren't very well behaved with respect to timing out.

First, I can't figure out how to set a timeout on "connect". I know I can set requstTimeout, which will correctly timeout after an initial handshake… But if the server doesn't handshake, the connection doesn't time out (eg, the server accepts the connection, then does nothing with it, the client will just be left hanging).

Second, when a requestTimeout fires (timing out the request), Flex doesn't actually take any steps to tear down the connection – it just leaves it hanging there (no RST or the like). Clearly, this is more than a little bit undesirable. Is there any way to explicitly tear down the connection after the timeout?

I am using RemoteObject like this:

<RemoteObject id="foo" endpoint="http://bar" requestTimeout="42">
    <method … />
</RemoteObject>

回答1:

I believe you can listen for a faultEvent (That is triggered by the timeout) and have the connection killed in the handler.

Without diving into the source, I'm not sure how to set the connect timeout either.