【发布时间】:2014-02-03 21:39:01
【问题描述】:
来自java.net.Socket#setSoTimeout 的javadoc,它说:
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a <B>java.net.SocketTimeoutException</B> is raised, though the Socket is still valid.
对于 http put 操作,客户端可能会上传一个巨大的文件,客户端一直在写入,从不从服务器读取数据。
在这种情况下,如果我为http客户端设置了SocketTimeout,会不会在上传时抛出TimeoutException?
【问题讨论】: