Java socket read - why doesn't IIS close the socket?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonny

    Java socket read - why doesn't IIS close the socket?

    Hi everybody,

    I'm having problems with the following code:

    InputStream hostIn = hostSock.getInp utStream();

    while (true) {
    try {
    iRead = hostIn.read(m_B uf);
    }
    catch (IOException ex1) {
    System.out.prin tln("Error on receive.");
    }
    if (iRead == -1) {
    break;
    }
    m_HostRcv.add(n ew ByteArr( (byte[]) m_Buf.clone(), iRead) );
    rcvSum += iRead;
    }

    This code works fine with Apache webservers. hostIn.read returns -1 if
    there is nothing left to read. On IIS webservers the read method
    simply blocks if there is nothing left to receive. IIS doesn't seem to
    close the socket. What can I do to avoid this? How do other people
    handle this?

    Thanks in advance for your postings.

    Jonny
Working...