By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

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

P: n/a
Hi everybody,

I'm having problems with the following code:

InputStream hostIn = hostSock.getInputStream();

while (true) {
try {
iRead = hostIn.read(m_Buf);
}
catch (IOException ex1) {
System.out.println("Error on receive.");
}
if (iRead == -1) {
break;
}
m_HostRcv.add(new 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
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.