java/net/natPlainSocketImpl.cc: compilation error on Solaris

Alexandre Petit-Bianco apbianco@cygnus.com
Thu Dec 2 18:33:00 GMT 1999


I'm getting a build error on Solaris with the modification introduced
by Bryce:
Index: natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- natPlainSocketImpl.cc 1999年10月04日 21:37:30 1.13
+++ natPlainSocketImpl.cc 1999年11月23日 11:40:26 1.14
@@ -146,6 +147,10 @@ java::net::PlainSocketImpl::bind (java::
 #endif
 else
 goto error;
+
+ // Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
+ ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
+ 
 if (::bind (fnum, ptr, len) == 0)
 {
 address = host;
Here's the error message:
/home/apbianco/src/egcs-libgcj/libjava/java/net/natPlainSocketImpl.cc: In method `void java::net::PlainSocketImpl::bind (java::net::InetAddress *, __java_int)':/home/apbianco/src/egcs-libgcj/libjava/java/net/natPlainSocketImpl.cc:152: cannot convert `int *' to `const char *' for argument `4' to `setsockopt (int, int, int, const char *, int)'
The man page says:
 int setsockopt(int s, int level, int optname,
 const char *optval, int optlen);
 ... 
 Most socket-level options take an int for optval. For set-
 sockopt(), the optval parameter should be non-zero to enable
 a boolean option, or zero if the option is to be disabled.
 SO_LINGER uses a struct linger parameter that specifies the
 desired state of the option and the linger interval (see
This is with a freshly updated libgcj and gcc. I configured libgcj
with the --disable-shared option. 
I quickly searched the mailing list and haven't found an earlier
report -- surprisingly enough, it looks like I'm the first one to run
into this problem. Let me know if one thinks a PR should be filed.
./A


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /