src/solaris/native/java/net/PlainDatagramSocketImpl.c

Print this page

        

*** 952,961 **** --- 952,962 ---- JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env, jobject this) { jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID); int arg, fd, t = 1; + char tmpbuf[1024]; #ifdef AF_INET6 int domain = ipv6_available() ? AF_INET6 : AF_INET; #else int domain = AF_INET; #endif
*** 987,1004 **** #ifdef __APPLE__ arg = 65507; if (JVM_SetSockOpt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&arg, sizeof(arg)) < 0) { ! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", ! strerror(errno)); return; } if (JVM_SetSockOpt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&arg, sizeof(arg)) < 0) { ! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", ! strerror(errno)); return; } #endif /* __APPLE__ */ setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof(int)); --- 988,1005 ---- #ifdef __APPLE__ arg = 65507; if (JVM_SetSockOpt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&arg, sizeof(arg)) < 0) { ! getErrorString(errno, tmpbuf, sizeof(tmpbuf)); ! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", tmpbuf); return; } if (JVM_SetSockOpt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&arg, sizeof(arg)) < 0) { ! getErrorString(errno, tmpbuf, sizeof(tmpbuf)); ! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", tmpbuf); return; } #endif /* __APPLE__ */ setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof(int));
*** 1005,1017 **** #if defined(__linux__) arg = 0; int level = (domain == AF_INET6) ? IPPROTO_IPV6 : IPPROTO_IP; if ((setsockopt(fd, level, IP_MULTICAST_ALL, (char*)&arg, sizeof(arg)) < 0) && ! (errno != ENOPROTOOPT)) { ! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", ! strerror(errno)); close(fd); return; } #endif --- 1006,1019 ---- #if defined(__linux__) arg = 0; int level = (domain == AF_INET6) ? IPPROTO_IPV6 : IPPROTO_IP; if ((setsockopt(fd, level, IP_MULTICAST_ALL, (char*)&arg, sizeof(arg)) < 0) && ! (errno != ENOPROTOOPT)) ! { ! getErrorString(errno, tmpbuf, sizeof(tmpbuf)); ! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", tmpbuf); close(fd); return; } #endif