You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by tjmcsorley <to...@TheMcSorleys.com> on 2007/11/16 15:29:53 UTC

Example code NHTTPClient.java - CONNECTION_TIMEOUT not working?

I've taken the example code in NHTTPClient.java and modified only the TCP
port refereneced on the 3 requests that are made to port 80... I changed the
port to 1080 instead... so that the Connection attempt will fail since
nobody is listening on this port at the server the request is sent to...

I expect the connectionTimeout() method in the EventLogger class to be
called in 10000ms... but it appears to never be called...  Am I missing
something?  Should this be called in 10 seconds when the connection attempt
fails?

Thanks,

- tom

-- 
View this message in context: http://www.nabble.com/Example-code-NHTTPClient.java---CONNECTION_TIMEOUT-not-working--tf4821532.html#a13793987
Sent from the HttpComponents-Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Re: Example code NHTTPClient.java - CONNECTION_TIMEOUT not working?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2007-11-16 at 06:29 -0800, tjmcsorley wrote: 
> I've taken the example code in NHTTPClient.java and modified only the TCP
> port refereneced on the 3 requests that are made to port 80... I changed the
> port to 1080 instead... so that the Connection attempt will fail since
> nobody is listening on this port at the server the request is sent to...
> 
> I expect the connectionTimeout() method in the EventLogger class to be
> called in 10000ms... but it appears to never be called...  Am I missing
> something?  Should this be called in 10 seconds when the connection attempt
> fails?
> 

Hi Tom,

No, it should not. The I/O reactor fires events on the IOEventDispatch
interface [1] for _established_ connections only (as it needs to pass
the connection that caused the event as a parameter). 

If you want to be notified about events for connection _requests_ you
should be using SessionRequestCallback interface [2]

Hope this helps

Oleg

[1]
http://jakarta.apache.org/httpcomponents/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/reactor/IOEventDispatch.html
[2]
http://jakarta.apache.org/httpcomponents/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/reactor/SessionRequestCallback.html


> Thanks,
> 
> - tom
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org