17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 */
28
29 #include "jni.h"
30 #include "jni_util.h"
31 #include "jvm.h"
32 #include "jlong.h"
33 #include "sun_nio_ch_DatagramDispatcher.h"
34 #include <sys/types.h>
35 #include <sys/uio.h>
36 #include <sys/socket.h>
37
38 #include "nio_util.h"
39 #include <limits.h>
40
41 JNIEXPORT jint JNICALL
42 Java_sun_nio_ch_DatagramDispatcher_read0(JNIEnv *env, jclass clazz,
43 jobject fdo, jlong address, jint len)
44 {
45 jint fd = fdval(env, fdo);
46 void *buf = (void *)jlong_to_ptr(address);
47 int result = recv(fd, buf, len, 0);
48 if (result < 0 && errno == ECONNREFUSED) {
49 JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException", 0);
50 return -2;
51 }
52 return convertReturnVal(env, result, JNI_TRUE);
53 }
54
55
56 JNIEXPORT jlong JNICALL
|
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 */
28
29 #include "jni.h"
30 #include "jni_util.h"
31 #include "jvm.h"
32 #include "jlong.h"
33 #include "sun_nio_ch_DatagramDispatcher.h"
34 #include <sys/types.h>
35 #include <sys/uio.h>
36 #include <sys/socket.h>
37 #include <string.h>
38
39 #include "nio_util.h"
40 #include <limits.h>
41
42 JNIEXPORT jint JNICALL
43 Java_sun_nio_ch_DatagramDispatcher_read0(JNIEnv *env, jclass clazz,
44 jobject fdo, jlong address, jint len)
45 {
46 jint fd = fdval(env, fdo);
47 void *buf = (void *)jlong_to_ptr(address);
48 int result = recv(fd, buf, len, 0);
49 if (result < 0 && errno == ECONNREFUSED) {
50 JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException", 0);
51 return -2;
52 }
53 return convertReturnVal(env, result, JNI_TRUE);
54 }
55
56
57 JNIEXPORT jlong JNICALL
|