< prev index next >

src/java.base/windows/native/libnet/PlainSocketImpl.c

Print this page
rev 53271 : 8216981: Per thread IO statistics in JFR


 493     if (opt == java_net_SocketOptions_SO_LINGER)
 494         return linger.l_onoff ? linger.l_linger : -1;
 495     else
 496         return result;
 497 }
 498 
 499 /*
 500  * Class:     java_net_PlainSocketImpl
 501  * Method:    sendOOB
 502  * Signature: (II)V
 503  */
 504 JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_sendOOB
 505   (JNIEnv *env, jclass clazz, jint fd, jint data) {
 506     jint n;
 507     unsigned char d = (unsigned char) data & 0xff;
 508 
 509     n = send(fd, (char *)&data, 1, MSG_OOB);
 510     if (n == SOCKET_ERROR) {
 511         NET_ThrowNew(env, WSAGetLastError(), "send");
 512     }



 513 }
 514 
 515 /*
 516  * Class:     java_net_PlainSocketImpl
 517  * Method:    configureBlocking
 518  * Signature: (IZ)V
 519  */
 520 JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_configureBlocking
 521   (JNIEnv *env, jclass clazz, jint fd, jboolean blocking) {
 522     u_long arg;
 523     int result;
 524 
 525     if (blocking == JNI_TRUE) {
 526         arg = SET_BLOCKING;      // 0
 527     } else {
 528         arg = SET_NONBLOCKING;   // 1
 529     }
 530 
 531     result = ioctlsocket(fd, FIONBIO, &arg);
 532     if (result == SOCKET_ERROR) {


 493     if (opt == java_net_SocketOptions_SO_LINGER)
 494         return linger.l_onoff ? linger.l_linger : -1;
 495     else
 496         return result;
 497 }
 498 
 499 /*
 500  * Class:     java_net_PlainSocketImpl
 501  * Method:    sendOOB
 502  * Signature: (II)V
 503  */
 504 JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_sendOOB
 505   (JNIEnv *env, jclass clazz, jint fd, jint data) {
 506     jint n;
 507     unsigned char d = (unsigned char) data & 0xff;
 508 
 509     n = send(fd, (char *)&data, 1, MSG_OOB);
 510     if (n == SOCKET_ERROR) {
 511         NET_ThrowNew(env, WSAGetLastError(), "send");
 512     }
 513     if (n > 0) {
 514         JVM_callNetworkWriteBytes(env, n);
 515     }
 516 }
 517 
 518 /*
 519  * Class:     java_net_PlainSocketImpl
 520  * Method:    configureBlocking
 521  * Signature: (IZ)V
 522  */
 523 JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_configureBlocking
 524   (JNIEnv *env, jclass clazz, jint fd, jboolean blocking) {
 525     u_long arg;
 526     int result;
 527 
 528     if (blocking == JNI_TRUE) {
 529         arg = SET_BLOCKING;      // 0
 530     } else {
 531         arg = SET_NONBLOCKING;   // 1
 532     }
 533 
 534     result = ioctlsocket(fd, FIONBIO, &arg);
 535     if (result == SOCKET_ERROR) {
< prev index next >