8217461: (ch) Add Net.available to return the number of bytes in the socket input buffer

Reviewed-by: clanger, michaelm
This commit is contained in:
Alan Bateman 2019-01-22 16:39:52 +00:00
parent aa5637f24e
commit 755872aa82
8 changed files with 52 additions and 17 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -524,8 +524,12 @@ public class Net {
static native int poll(FileDescriptor fd, int events, long timeout)
throws IOException;
// -- Multicast support --
/**
* Return the number of bytes in the socket input buffer.
*/
static native int available(FileDescriptor fd) throws IOException;
// -- Multicast support --
/**
* Join IPv4 multicast group

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,6 +180,9 @@ int NET_IsZeroAddr(jbyte* caddr);
* platform-specific pre/post processing of the arguments and/or results.
*/
JNIEXPORT int JNICALL
NET_SocketAvailable(int fd, int *pbytes);
JNIEXPORT int JNICALL
NET_GetSockOpt(int fd, int level, int opt, void *result, int *len);