* java/net/ServerSocket.java: Define ANY_IF.
(ServerSocket (int,int)): Use ANY_IF instead of null to bind to
all network interfaces.
* java/net/DatagramSocket.java (DatagramSocket): ditto.
* java/net/natPlainSocketImpl.cc (bind): Expect 0.0.0' instead of
null.
* java/net/natPlainDatagramSocketImpl (bind): Expect 0.0.0'
instead of null.
From-SVN: r28429
* boehm.cc (_Jv_RegisterFinalizer): Cast `meth' to GC_PTR.
* exception.cc (_Jv_Throw): Cast `_Jv_type_matcher' to __eh_matcher.
+ * java/net/ServerSocket.java: Define ANY_IF.
+ (ServerSocket (int,int)): Use ANY_IF instead of null to bind to
+ all network interfaces.
+ * java/net/DatagramSocket.java (DatagramSocket): ditto.
+ * java/net/natPlainSocketImpl.cc (bind): Expect `0.0.0.0' instead of
+ null.
+ * java/net/natPlainDatagramSocketImpl (bind): Expect `0.0.0.0'
+ instead of null.
1999-08-01 Alexandre Oliva <oliva@dcc.unicamp.br>
void
_Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *meth)
{
- GC_REGISTER_FINALIZER_NO_ORDER (object, call_finalizer, (GC_PTR)meth,
+ GC_REGISTER_FINALIZER_NO_ORDER (object, call_finalizer, (GC_PTR) meth,
NULL, NULL);
}
_Jv_eh_alloc ();
ehinfo = *(__get_eh_info ());
}
- ehinfo->eh_info.match_function = (__eh_matcher)_Jv_type_matcher;
+ ehinfo->eh_info.match_function = (__eh_matcher) _Jv_type_matcher;
ehinfo->eh_info.language = EH_LANG_Java;
ehinfo->eh_info.version = 1;
ehinfo->value = value;
public DatagramSocket() throws SocketException
{
- this(0, null);
+ this(0, ServerSocket.ANY_IF);
}
public DatagramSocket(int port) throws SocketException
{
- this(port, null);
+ this(port, ServerSocket.ANY_IF);
}
public DatagramSocket(int port, InetAddress laddr) throws SocketException
static SocketImplFactory factory;
SocketImpl impl;
+ static final byte[] zeros = {0,0,0,0};
+ /* dummy InetAddress, used to bind socket to any (all) network interfaces */
+ static final InetAddress ANY_IF = new InetAddress(zeros, null);
+
public ServerSocket (int port)
throws java.io.IOException
{
public ServerSocket (int port, int backlog)
throws java.io.IOException
{
- this(port, backlog, null);
+ this(port, backlog, ANY_IF);
}
public ServerSocket (int port, int backlog, InetAddress bindAddr)
// FIXME: prob. need to do a setsockopt with SO_BROADCAST to allow multicast.
union SockAddr u;
struct sockaddr *ptr = (struct sockaddr *) &u.address;
- jbyte *bytes = NULL;
// FIXME: Use getaddrinfo() to get actual protocol instead of assuming ipv4.
- int len = 4; // Initialize for INADDR_ANY in case host is NULL.
-
- if (host != NULL)
- {
- jbyteArray haddress = host->address;
- bytes = elements (haddress);
- len = haddress->length;
- }
+ jbyteArray haddress = host->address;
+ jbyte *bytes = elements (haddress);
+ int len = haddress->length;
if (len == 4)
{
{
union SockAddr u;
struct sockaddr *ptr = (struct sockaddr *) &u.address;
- jbyte *bytes = NULL;
- // FIXME: Use getaddrinfo() to get actual protocol instead of assuming ipv4.
- int len = 4; // Initialize for INADDR_ANY in case host is NULL.
+ jbyteArray haddress = host->address;
+ jbyte *bytes = elements (haddress);
+ int len = haddress->length;
- if (host != NULL)
- {
- jbyteArray haddress = host->address;
- bytes = elements (haddress);
- len = haddress->length;
- }
-
if (len == 4)
{
u.address.sin_family = AF_INET;