Specifying a port in HttpPost

by drill » Sat, 27 Feb 2010 18:36:27 GMT


Sponsored Links
 I want to make a Http-post-request to a webserver on a specific port.
For that I use the HttpPost constructor as follows:
HttpPost post = new HttpPost(" http://webpage.com :1212/httppost.php");
Then I put some parameters with it using
post.setEntity(params);
When I now want to execute that request with
HttpResponse response = client.execute(post);
I receive a NoHttpResponseException.
The server is available and when I try all that without a port I don't
get that exception, but I need to specify my port. Is there anybody
who had a similar problem or do have a solution for me?

Thanks a lot.
regards

--



Other Threads

1. NIO select issue make program crash(also posted this in Internal group)

Hi Google expert and socket expert
     We meet a crash issue when using NIO selector.
     After check the stack we find it die in free(fdset_read);

    Did you meet the same issue?
    Do you have solution to avoid this issue ?
    Any suggestions are welcome.
    Thanks

Regards
Huadong

static jint osNetworkSystem_selectImpl(JNIEnv* env, jclass clazz,
        jobjectArray readFDArray, jobjectArray writeFDArray, jint
countReadC,
        jint countWriteC, jintArray outFlags, jlong timeout) {
    // LOGD("ENTER selectImpl");

    struct timeval timeP;
    int result = 0;
    int size = 0;
    jobject gotFD;
    fd_set *fdset_read,*fdset_write;
    int handle;
    jboolean isCopy ;
    jint *flagArray;
    int val;
    unsigned int time_sec = (unsigned int)timeout/1000;
    unsigned int time_msec = (unsigned int)(timeout%1000)*1000;

    fdset_read = (fd_set *)malloc(sizeof(fd_set));
    fdset_write = (fd_set *)malloc(sizeof(fd_set));

    FD_ZERO(fdset_read);
    FD_ZERO(fdset_write);

    for (val = 0; val<countReadC; val++) {

        gotFD = env->GetObjectArrayElement(readFDArray,val);

        handle = jniGetFDFromFileDescriptor(env, gotFD);

        FD_SET(handle, fdset_read);

        if (0 > (size - handle)) {
            size = handle;
        }
    }

    for (val = 0; val<countWriteC; val++) {

        gotFD = env->GetObjectArrayElement(writeFDArray,val);

        handle = jniGetFDFromFileDescriptor(env, gotFD);

        FD_SET(handle, fdset_write);

        if (0 > (size - handle)) {
            size = handle;
        }
    }
    /* the size is the max_fd + 1 */
    size =size + 1;

    if (0 > size) {
        result = SOCKERR_FDSET_SIZEBAD;
    } else {
      /* only set when timeout >= 0 (non-block)*/
        if (0 <= timeout) {

            timeP.tv_sec = time_sec;
            timeP.tv_usec = time_msec*1000;

            result = sockSelect(size, fdset_read, fdset_write, NULL,
&timeP);

        } else {
            result = sockSelect(size, fdset_read, fdset_write, NULL,
NULL);
        }
    }

    if (0 < result) {
       /*output the result to a int array*/
       flagArray = env->GetIntArrayElements(outFlags, &isCopy);

       for (val=0; val<countReadC; val++) {
            gotFD = env->GetObjectArrayElement(readFDArray,val);

            handle = jniGetFDFromFileDescriptor(env, gotFD);

            if (FD_ISSET(handle,fdset_read)) {
                flagArray[val] = SOCKET_OP_READ;
            } else {
                flagArray[val] = SOCKET_OP_NONE;
            }
        }

        for (val=0; val<countWriteC; val++) {

            gotFD = env->GetObjectArrayElement(writeFDArray,val);

            handle = jniGetFDFromFileDescriptor(env, gotFD);

            if (FD_ISSET(handle,fdset_write)) {
                flagArray[val+countReadC] = SOCKET_OP_WRITE;
            } else {
                flagArray[val+countReadC] = SOCKET_OP_NONE;
            }
        }

        env->ReleaseIntArrayElements(outFlags, flagArray, 0);
    }

    free(fdset_write);
    dead here    free(fdset_read);

    /* return both correct and error result, let java handle the
exception*/
    return result;
}
--~--~---------~--~----~------------~-------~--~----~

2. : how to store a image in database

Hi
I stored the images in  the sqlite as byte[]
but when I retrive it and convert to bitmap.decodebytearray
it shows skia exception !!!
dont know whta to do ?
if u could solve it plz reply
--~--~---------~--~----~------------~-------~--~----~

3. Spinner View

4. persistent socket connection

5. About WebView setOnClickListener

6. souce code released

7. OTA G1 update planned for 23rd October..