RFR: 8189366: SocketInputStream.available() should check for eof

vyom tewari vyom.tewari at oracle.com
Wed Oct 10 13:16:11 UTC 2018


Hi All,

Please provide your review comments on below fix.

Thanks,

Vyom


On Friday 27 October 2017 11:31 AM, vyom tewari wrote:
>
>
>
> On Thursday 26 October 2017 03:14 PM, Bernd Eckenfels wrote:
>> What is currently returned at the end of a stream? This looks like a 
>> dangerous thing to do, if a existing implementation only
> Currently it returns 0 at end of stream and  same as after change. As 
> David pointed out that ultimately it delegates on to "ioctl", i 
> checked the doc(http://man7.org/linux/man-pages/man4/tty_ioctl.4.html) 
> and did not found anything which tells about eof.
>
> What i found out, setting eof at socketinputstream there is no effect 
> on native  "ioctl" call. I set the "eof"  and 
> SocketInputStream.available() return 0.
>
> Let's wait for other people opinions.
>
> Note: you have to shutdown the SocketInputstream to set "eof", i am 
> not sure if there is any other way to set "eof" for SocketInputStream.
>
> Thanks,
> Vyom
>
>> read when something is available it might never detect that it 
>> reached EOF.
>>
>> Gruss
>> Bernd
>> -- 
>> http://bernd.eckenfels.net
>> ------------------------------------------------------------------------
>> *From:* net-dev <net-dev-bounces at openjdk.java.net> on behalf of vyom 
>> tewari <vyom.tewari at oracle.com>
>> *Sent:* Thursday, October 26, 2017 11:26:15 AM
>> *To:* OpenJDK Network Dev list
>> *Subject:* RFR: 8189366: SocketInputStream.available() should check 
>> for eof
>> Hi All,
>>
>> Please review the simple change below.
>>
>> Webrev   : 
>> http://cr.openjdk.java.net/~vtewari/8189366/webrev0.0/index.html 
>> <http://cr.openjdk.java.net/%7Evtewari/8189366/webrev0.0/index.html>
>>
>> BugId      : https://bugs.openjdk.java.net/browse/JDK-8189366
>>
>>
>> Currently SocketInputStream.available() does not check for "eof" and
>> simply delegate to the impl even when "eof" reached. I put a check  to
>> return 0 if "eof" is already reached.
>>
>> Thanks,
>>
>> Vyom
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20181010/53223098/attachment.html>


More information about the net-dev mailing list