Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 1
Registered: ‎01-07-2010
My Device: Not Specified

Connector & http timeout



i'm trying to set a timeout on a HttpConnection.


I'm using this code :

long timeoutInMillis = 5000;

HttpConnection httpConnection = (HttpConnection) Connector.open(url + ";deviceside=true", Connector.READ_WRITE, true);
if (timeoutInMillis > 0) {
    if (httpConnection instanceof SocketConnectionEnhanced) {
        ((SocketConnectionEnhanced) httpConnection)
                .setSocketOptionEx(SocketConnectionEnhanced.READ_TIMEOUT, timeoutInMillis);
    } else {
        Log.w(TAG, "Timeout could not be set");


My problem is that i cannot set a timeout lesser than 30 s : that way the API seems to override my value, and replace it by 30 s.


May this problem be bypassed by another way?