Hi,
this patch removes the above mentioned class and implements their functions
elsewhere. DatagramImpl.connect() has a different exception clause than
SocketImpl.connect() and fixing that required some changes in method signatures
and the native implementation of VMChannel.

These changes are crucial for the porting of Classpath' IO system to GCJ which I
am currently doing.


ChangeLog:
2006-10-09  Robert Schuster  <[EMAIL PROTECTED]>

        * gnu/java/net/PlainSocketImpl.java:
        (connect): Use VMChannel instance for connect call.
        (getTimeToLive): Call VMPlainSocketImpl.getTimeToLive.
        (setTimeToLive): Call VMPlainSocketImpl.setTimeToLive.
        * include/Makefile.am: Removed all occurences of
        gnu_java_net_VMPlainDatagramSocketImpl.h.
        * include/gnu_java_net_VMPlainDatagramSocketImpl.h: Removed.
        * native/jni/java-net/Makefile.am: Removed
        gnu_java_net_VMPlainDatagramSocketImpl.c from sources.
        * native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c:
        Removed.
        as SocketException, declare to throw SocketException.
        * native/jni/java-nio/gnu_java_net_VMChannel.c: Added definitions
        for SocketException and ConnectException.
        (Java_gnu_java_nio_VMChannel_connect): Throw SocketException instead
        of IOException.
        (Java_gnu_java_nio_VMChannel_connect6): Throw SocketException instead
        of IOException.
        * native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c: Added
        CPNET_IP_TTL to java_sockopt enum.
        (Java_gnu_java_net_VMPlainSocketImpl_setOption): Handle CPNET_IP_TTL
        case.
        (Java_gnu_java_net_VMPlainSocketImpl_getOption): Handle CPNET_IP_TTL
        case.
        * vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java: Removed.
        * vm/reference/gnu/java/nio/VMChannel.java:
        (connect(int, byte[], int, int)): Declare to throw SocketException.
        (connect6): Declare to throw SocketException.
        (connect(InetSocketAddress, int)): Catch IOException and rethrow
        * vm/reference/gnu/java/net/VMPlainSocketImpl.java:
        (setTimeToLive): New method.
        (getTimeToLive): New method.
        * NEWS: Documented VM interface changes.

cya
Robert
Index: include/Makefile.am
===================================================================
RCS file: /cvsroot/classpath/classpath/include/Makefile.am,v
retrieving revision 1.71
diff -u -r1.71 Makefile.am
--- include/Makefile.am	20 Sep 2006 21:39:41 -0000	1.71
+++ include/Makefile.am	8 Oct 2006 23:26:53 -0000
@@ -125,7 +125,6 @@
 $(GTKPEER_H_FILES) \
 $(QTPEER_H_FILES) \
 $(GCONF_PREFS_FILES) \
-$(top_srcdir)/include/gnu_java_net_VMPlainDatagramSocketImpl.h \
 $(top_srcdir)/include/gnu_java_net_VMPlainSocketImpl.h \
 $(top_srcdir)/include/gnu_java_net_local_LocalSocketImpl.h \
 $(top_srcdir)/include/gnu_java_nio_EpollSelectorImpl.h \
@@ -180,8 +179,6 @@
 $(top_srcdir)/include/gnu_java_util_prefs_gconf_%.h: $(top_builddir)/$(CLASSDIR)/gnu/java/util/prefs/gconf/%.class
 	$(JAVAH) -o $@ gnu.java.util.prefs.gconf.$*
 
-$(top_srcdir)/include/gnu_java_net_VMPlainDatagramSocketImpl.h: $(top_srcdir)/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java
-	$(JAVAH) -o $@ gnu.java.net.VMPlainDatagramSocketImpl
 $(top_srcdir)/include/gnu_java_net_VMPlainSocketImpl.h: $(top_srcdir)/vm/reference/gnu/java/net/VMPlainSocketImpl.java
 	$(JAVAH) -o $@ gnu.java.net.VMPlainSocketImpl
 $(top_srcdir)/include/gnu_java_net_local_LocalSocketImpl.h: $(top_srcdir)/gnu/java/net/local/LocalSocketImpl.java
Index: include/gnu_java_net_VMPlainDatagramSocketImpl.h
===================================================================
RCS file: include/gnu_java_net_VMPlainDatagramSocketImpl.h
diff -N include/gnu_java_net_VMPlainDatagramSocketImpl.h
--- include/gnu_java_net_VMPlainDatagramSocketImpl.h	19 Mar 2006 23:17:16 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#ifndef __gnu_java_net_VMPlainDatagramSocketImpl__
-#define __gnu_java_net_VMPlainDatagramSocketImpl__
-
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_bind (JNIEnv *env, jclass, jobject, jint, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_create (JNIEnv *env, jclass, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_connect (JNIEnv *env, jclass, jobject, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_nativeSendTo (JNIEnv *env, jclass, jobject, jobject, jint, jbyteArray, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_nativeReceive (JNIEnv *env, jclass, jobject, jbyteArray, jint, jint, jbyteArray, jintArray, jintArray);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_setOption (JNIEnv *env, jclass, jobject, jint, jobject);
-JNIEXPORT jobject JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_getOption (JNIEnv *env, jclass, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_close (JNIEnv *env, jclass, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_join (JNIEnv *env, jclass, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_net_VMPlainDatagramSocketImpl_leave (JNIEnv *env, jclass, jobject, jobject);
-#undef gnu_java_net_VMPlainDatagramSocketImpl_IP_TTL
-#define gnu_java_net_VMPlainDatagramSocketImpl_IP_TTL 7777L
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gnu_java_net_VMPlainDatagramSocketImpl__ */
Index: native/jni/java-net/Makefile.am
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/Makefile.am,v
retrieving revision 1.18
diff -u -r1.18 Makefile.am
--- native/jni/java-net/Makefile.am	21 Aug 2006 23:34:45 -0000	1.18
+++ native/jni/java-net/Makefile.am	8 Oct 2006 23:26:53 -0000
@@ -13,7 +13,6 @@
 			java_net_VMInetAddress.c \
 			java_net_VMNetworkInterface.c \
 			java_net_VMURLConnection.c \
-			gnu_java_net_VMPlainDatagramSocketImpl.c \
                         gnu_java_net_VMPlainSocketImpl.c \
 			$(local_sources)
 
Index: native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c
===================================================================
RCS file: native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c
diff -N native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c
--- native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c	21 Aug 2006 23:34:45 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,406 +0,0 @@
-/* VMPlainDatagramSocketImpl.c - Native methods for PlainDatagramSocketImpl
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
- 
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-/* do not move; needed here because of some macro definitions */
-#include <config.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <jni.h>
-#include <jcl.h>
-
-#include "cpnative.h"
-#include "cpnet.h"
-
-#include "javanet.h"
-
-#include "gnu_java_net_VMPlainDatagramSocketImpl.h"
-
-/*
- * Note that most of the functions in this module simply redirect to another
- * internal function.  Why?  Because many of these functions are shared
- * with PlainSocketImpl. 
- */
-
-/*************************************************************************/
-
-/*
- * Creates a new datagram socket
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_create(JNIEnv *env,
-						   jclass klass __attribute__ ((__unused__))
-						   , jobject obj)
-{
-
-#ifndef WITHOUT_NETWORK
-  _javanet_create(env, obj, 0);
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * Close the socket.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_close(JNIEnv *env,
-						  jclass klass __attribute__ ((__unused__)),
-						  jobject obj)
-{
-
-#ifndef WITHOUT_NETWORK
-  _javanet_close(env, obj, 0);
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * Connects to the specified destination.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_connect(JNIEnv *env,
-						    jclass klass __attribute__ ((__unused__)),
-						    jobject obj,
-						    jobject addr, jint port)
-{
-#ifndef WITHOUT_NETWORK
-
-  _javanet_connect(env, obj, addr, port, 0);
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * This method binds the specified address to the specified local port.
- * Note that we have to set the local address and local port public instance 
- * variables. 
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_bind(JNIEnv *env,
-						 jclass klass __attribute__ ((__unused__)),
-						 jobject obj,
-						 jint port, jobject addr)
-{
-
-#ifndef WITHOUT_NETWORK
-  _javanet_bind(env, obj, addr, port, 0);
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * This method sets the specified option for a socket
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_setOption(JNIEnv *env,
-						      jclass klass __attribute__ ((__unused__)),
-						      jobject obj, 
-						      jint option_id,
-						      jobject val)
-{
-
-#ifndef WITHOUT_NETWORK
-  _javanet_set_option(env, obj, option_id, val);
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * This method sets the specified option for a socket
- */
-JNIEXPORT jobject JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_getOption(JNIEnv *env,
-						      jclass klass __attribute__ ((__unused__)),
-						      jobject obj, 
-						      jint option_id)
-{
-
-#ifndef WITHOUT_NETWORK
-  return(_javanet_get_option(env, obj, option_id));
-#else /* not WITHOUT_NETWORK */
-  return NULL;
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * Reads a buffer from a remote host
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_nativeReceive(JNIEnv     *env,
-                                                          jclass     klass __attribute__ ((__unused__)),
-                                                          jobject    obj,
-                                                          jbyteArray arr,
-                                                          jint       offset,
-                                                          jint       length,
-                                                          jbyteArray receivedFromAddress,
-                                                          jintArray  receivedFromPort,
-                                                          jintArray  receivedLength)
-{
-#ifndef WITHOUT_NETWORK
-  jint          *port, *bytes_read;
-  cpnet_address *addr;
-  jbyte          *addressBytes;
-
-  addr = 0;
-    
-  port = (jint*)(*env)->GetIntArrayElements(env, receivedFromPort, NULL);
-  if (port == NULL)
-    {
-      JCL_ThrowException(env, IO_EXCEPTION, "Internal error: could not access receivedFromPort array");
-      return;
-    }
-  
-  bytes_read = (jint*)(*env)->GetIntArrayElements(env, receivedLength, NULL);
-  if (bytes_read == NULL)
-    {
-      (*env)->ReleaseIntArrayElements(env, receivedFromPort, (jint*)port, 0);
-      JCL_ThrowException(env, IO_EXCEPTION, "Internal error: could not access receivedLength array");
-      return;
-    }
-
-  /* Receive the packet */
-  /* should we try some sort of validation on the length? */
-  (*bytes_read) = _javanet_recvfrom(env, obj, arr, offset, length, &addr);
-
-  /* Special case the strange situation where the receiver didn't want any
-     bytes. */
-  if (length == 0 && (*bytes_read) == -1)
-    *bytes_read = 0;
-
-  if ((*bytes_read) == -1)
-    {
-      (*env)->ReleaseIntArrayElements(env, receivedFromPort, (jint*)port, 0);
-      (*env)->ReleaseIntArrayElements(env, receivedLength, (jint*)bytes_read, 0);
-      JCL_ThrowException(env, IO_EXCEPTION, "Internal error: receive");
-      return;
-    }
-
-  if ((*env)->ExceptionOccurred(env))
-    return;
-
-  *port = cpnet_addressGetPort (addr);
-  
-  /* Store the address */
-  addressBytes = (jbyte*)(*env)->GetPrimitiveArrayCritical(env, receivedFromAddress, NULL);
-  cpnet_IPV4AddressToBytes (addr, addressBytes);
-  (*env)->ReleasePrimitiveArrayCritical(env, receivedFromAddress, addressBytes, 0);
-  
-  cpnet_freeAddress (env, addr);
-  
-  (*env)->ReleaseIntArrayElements(env, receivedFromPort, (jint*)port, 0);
-  (*env)->ReleaseIntArrayElements(env, receivedLength, (jint*)bytes_read, 0);
-
-  DBG("PlainDatagramSocketImpl.receive(): Received packet\n");
-  
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * Writes a buffer to the remote host
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_nativeSendTo(JNIEnv  *env,
-                                                         jclass  klass __attribute__ ((__unused__)),
-                                                         jobject obj, 
-                                                         jobject addr,
-                                                         jint    port,
-                                                         jarray  buf, 
-                                                         jint    offset,
-                                                         jint    len)
-{
-#ifndef WITHOUT_NETWORK
-  cpnet_address *netAddress;
-
-  /* check if address given, tr 7.3.2005 */
-  if (addr != NULL )
-    {
-      netAddress = _javanet_get_ip_netaddr(env, addr);
-      if ((*env)->ExceptionOccurred(env))
-        {	  
-          return;
-        }
-      if (port == 0)
-	{
-	  JCL_ThrowException(env, IO_EXCEPTION,
-			     "Invalid port number");
-	  cpnet_freeAddress(env, netAddress);
-	  return;
-	}
-      cpnet_addressSetPort (netAddress, port);
-    }
-  else
-    {
-      netAddress = NULL;
-    }
-
-  DBG("PlainDatagramSocketImpl.sendto(): have addr\n");
-
-  _javanet_sendto(env, obj, buf, offset, len, netAddress);
-  if (netAddress != NULL)
-    cpnet_freeAddress(env, netAddress);
-  if ((*env)->ExceptionOccurred(env))
-    {
-      return;
-    }
-
-  DBG("PlainDatagramSocketImpl.sendto(): finished\n");
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * Joins a multicast group
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_join(JNIEnv *env,
-						 jclass klass __attribute__ ((__unused__)),
-						 jobject obj, 
-						 jobject addr)
-{
-#ifndef WITHOUT_NETWORK
-  cpnet_address *netAddress;
-  int  fd;
-  int  result;
-
-  /* check if address given, tr 7.3.2005 */
-  if (addr != NULL)
-    {
-      netAddress = _javanet_get_ip_netaddr(env, addr);
-      if ((*env)->ExceptionOccurred(env))
-        {
-          JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
-          return;
-        }
-    }
-  else
-    {
-      netAddress = NULL;
-    }
-
-  fd = _javanet_get_int_field(env, obj, "native_fd");
-  if ((*env)->ExceptionOccurred(env))
-    {
-      JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
-      return;
-    }
-
-  DBG("PlainDatagramSocketImpl.join(): have native fd\n");
-
-  result = cpnet_addMembership (env, fd, netAddress);
-  if (result != CPNATIVE_OK)
-    {
-      JCL_ThrowException(env, IO_EXCEPTION, 
-			 cpnative_getErrorString (result));
-      return;
-    }
-
-  DBG("PlainDatagramSocketImpl.join(): finished\n");
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
-/*************************************************************************/
-
-/*
- * Leaves a multicast group
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_net_VMPlainDatagramSocketImpl_leave(JNIEnv *env,
-						  jclass klass __attribute__ ((__unused__)),
-						  jobject obj, 
-						  jobject addr)
-{
-#ifndef WITHOUT_NETWORK
-  cpnet_address *netAddress;
-  int  fd;
-  int  result;
-
-  /* check if address given, tr 7.3.2005 */
-  if (addr != NULL)
-    {
-      netAddress = _javanet_get_ip_netaddr(env, addr);
-      if ((*env)->ExceptionOccurred(env))
-        {
-          JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
-          return;
-        }
-    }
-  else
-    {
-      netAddress = 0;
-    }
-
-  fd = _javanet_get_int_field(env, obj, "native_fd");
-  if ((*env)->ExceptionOccurred(env))
-    {
-      JCL_ThrowException(env, IO_EXCEPTION, "Internal error"); 
-      return; 
-    }
-
-  DBG("PlainDatagramSocketImpl.leave(): have native fd\n");
-
-  result = cpnet_dropMembership (env, fd, netAddress);
-  if (result != CPNATIVE_OK)
-    {
-      JCL_ThrowException(env, IO_EXCEPTION, cpnative_getErrorString (result));
-      return;
-    }
-
-  DBG("PlainDatagramSocketImpl.leave(): finished\n");
-#else /* not WITHOUT_NETWORK */
-#endif /* not WITHOUT_NETWORK */
-}
-
Index: native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c,v
retrieving revision 1.8
diff -u -r1.8 gnu_java_net_VMPlainSocketImpl.c
--- native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c	19 Sep 2006 01:28:47 -0000	1.8
+++ native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c	8 Oct 2006 23:26:53 -0000
@@ -158,7 +158,10 @@
 }
 
 
-/* These constants are also defined in java/net/SocketOptions.java */
+/* These constants are also defined in java/net/SocketOptions.java.
+ * Except for CPNET_IP_TTL which is defined in 
+ * vm/reference/gnu/java/net/VMPlainSocketImpl.java .
+ */
 enum java_sockopt {
   CPNET_SO_KEEPALIVE = 0x8,
   CPNET_SO_LINGER = 0x80,
@@ -173,7 +176,8 @@
   CPNET_IP_MULTICAST_IF = 0x10,
   CPNET_IP_MULTICAST_IF2 = 0x1F,
   CPNET_IP_MULTICAST_LOOP = 0x12,
-  CPNET_IP_TOS = 0x03
+  CPNET_IP_TOS = 0x03,
+  CPNET_IP_TTL = 0x1E61
 };
 
 
@@ -256,6 +260,11 @@
       optname = IP_TOS;
       break;
 
+    case CPNET_IP_TTL:
+      level = IPPROTO_IP;
+      optname = IP_TTL;
+      break;
+
     case CPNET_SO_BINDADDR:
     case CPNET_IP_MULTICAST_IF:
     case CPNET_IP_MULTICAST_IF2:
@@ -339,6 +348,11 @@
       optname = IP_TOS;
       break;
 
+    case CPNET_IP_TTL:
+      level = IPPROTO_IP;
+      optname = IP_TTL;
+      break;
+
     case CPNET_SO_BINDADDR:
     case CPNET_IP_MULTICAST_IF:
     case CPNET_IP_MULTICAST_IF2:
Index: vm/reference/gnu/java/nio/VMChannel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/gnu/java/nio/VMChannel.java,v
retrieving revision 1.4
diff -u -r1.4 VMChannel.java
--- vm/reference/gnu/java/nio/VMChannel.java	27 Sep 2006 21:30:44 -0000	1.4
+++ vm/reference/gnu/java/nio/VMChannel.java	8 Oct 2006 23:26:53 -0000
@@ -379,23 +379,37 @@
    * @throws IOException If an error occurs while connecting.
    */
   public boolean connect(InetSocketAddress saddr, int timeout)
-    throws IOException
+    throws SocketException
   {
+    int fd;
+
     InetAddress addr = saddr.getAddress();
+ 
+    // Translates an IOException into a SocketException to conform
+    // to the throws clause.
+    try
+      {
+        fd = nfd.getNativeFD();
+      }
+    catch (IOException ioe)
+      {
+        throw new SocketException(ioe.getMessage());
+      }
+
     if (addr instanceof Inet4Address)
-      return connect(nfd.getNativeFD(), addr.getAddress(), saddr.getPort(),
+      return connect(fd, addr.getAddress(), saddr.getPort(),
                      timeout);
     if (addr instanceof Inet6Address)
-      return connect6(nfd.getNativeFD(), addr.getAddress(), saddr.getPort(),
+      return connect6(fd, addr.getAddress(), saddr.getPort(),
                       timeout);
-    throw new IOException("unsupported internet address");
+    throw new SocketException("unsupported internet address");
   }
   
   private static native boolean connect(int fd, byte[] addr, int port, int timeout)
-    throws IOException;
+    throws SocketException;
   
   private static native boolean connect6(int fd, byte[] addr, int port, int timeout)
-    throws IOException;
+    throws SocketException;
   
   /**
    * Disconnect this channel, if it is a datagram socket. Disconnecting
Index: vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java
===================================================================
RCS file: vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java
diff -N vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java
--- vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java	12 Jan 2006 11:56:08 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,260 +0,0 @@
-/* PlainDatagramSocketImpl.java -- VM interface for DatagramSocket impl
-   Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
- 
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net;
-
-import gnu.classpath.Configuration;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketAddress;
-import java.net.SocketException;
-
-/**
- * The VM interface for [EMAIL PROTECTED] gnu.java.net.PlainDatagramSocketImpl}.
- *
- * @author Ingo Proetel ([EMAIL PROTECTED])
- * @author Roman Kennke ([EMAIL PROTECTED])
- */
-public final class VMPlainDatagramSocketImpl
-{
-  /**
-   * Option id for the IP_TTL (time to live) value.
-   */
-  static final int IP_TTL = 0x1E61; // 7777
-
-
-  // Static initializer to load native library
-  static
-  {
-    if (Configuration.INIT_LOAD_LIBRARY)
-      {
-        System.loadLibrary("javanet");
-      }
-  }
-  
-  /**
-   * Binds this socket to a particular port and interface
-   *
-   * @param socket the socket object
-   * @param port the port to bind to
-   * @param addr the address to bind to
-   *
-   * @throws SocketException If an error occurs
-   */  
-  static native void bind(PlainDatagramSocketImpl socket, int port,
-                          InetAddress addr) 
-    throws SocketException;
-
-  /**
-   * Creates a new datagram socket.
-   *
-   * @param socket the socket object
-   *
-   * @throws SocketException If an error occurs
-   */
-  static native void create(PlainDatagramSocketImpl socket)
-    throws SocketException;
-
-  /**
-   * Connects to the remote address and port specified as arguments.
-   *
-   * @param socket the socket object
-   * @param addr the remote address to connect to
-   * @param port the remote port to connect to
-   *
-   * @throws SocketException If an error occurs
-   */
-  static native void connect(PlainDatagramSocketImpl socket, InetAddress addr,
-                             int port)
-    throws SocketException;
-
-  /**
-   * Sends a packet of data to a remote host.
-   *
-   * @param socket the socket object
-   * @param packet the packet to send
-   *
-   * @throws IOException If an error occurs
-   */
-  static void send(PlainDatagramSocketImpl socket, DatagramPacket packet)
-    throws IOException
-  {
-    nativeSendTo(socket, packet.getAddress(), packet.getPort(),
-                 packet.getData(), packet.getOffset(), packet.getLength());
-  }
-
-
-  /**
-   * Sends a packet of data to a remote host.
-   *
-   * @param socket the socket object
-   * @param addr the address to send to
-   * @param port the port to send to 
-   * @param buf the buffer to send
-   * @param offset the offset of the data in the buffer to send
-   * @param len the length of the data to send
-   *
-   * @throws IOException If an error occurs
-   */
-  private static native void nativeSendTo(PlainDatagramSocketImpl socket,
-                                          InetAddress addr, int port,
-                                          byte[] buf, int offset, int len)
-    throws IOException;
-
-  /**
-   * Receives a UDP packet from the network
-   *
-   * @param socket the socket object
-   * @param packet the packet to fill in with the data received
-   *
-   * @throws IOException IOException If an error occurs
-   */
-  static void receive(PlainDatagramSocketImpl socket, DatagramPacket packet)
-    throws IOException
-  {
-    byte[] receiveFromAddress = new byte[4];
-    int[] receiveFromPort = new int[1];
-    int[] receivedLength = new int[1];
-
-    nativeReceive(socket, packet.getData(), packet.getOffset(),
-                  packet.getLength(),
-                  receiveFromAddress, receiveFromPort, receivedLength);
-
-    packet.setAddress(InetAddress.getByAddress(receiveFromAddress));
-    packet.setPort(receiveFromPort[0]);
-    packet.setLength(receivedLength[0]);
-  }
-
-  private static native void nativeReceive(PlainDatagramSocketImpl socket,
-                                           byte[] buf, int offset, int len,
-                                           byte[] receiveFromAddress,
-                                           int[] receiveFromPort,
-                                           int[] receivedLength)
-    throws IOException;
-
-  /**
-   * Sets the value of an option on the socket
-   *
-   * @param socket the socket object
-   * @param optionId the identifier of the option to set
-   * @param value the value of the option to set
-   *
-   * @exception SocketException If an error occurs
-   */
-  static native void setOption(PlainDatagramSocketImpl socket, int optionId,
-                               Object value)
-    throws SocketException;
-
-  /**
-   * Retrieves the value of an option on the socket.
-   *
-   * @param socket the socket object
-   * @param optionId the identifier of the option to retrieve
-   *
-   * @return the value of the option
-   *
-   * @throws SocketException if an error occurs
-   */
-  static native Object getOption(PlainDatagramSocketImpl socket, int optionId)
-    throws SocketException;
-
-  /**
-   * Closes the socket.
-   *
-   * @param socket the socket object
-   */
-  static native void close(PlainDatagramSocketImpl socket);
-
-  /**
-   * Joins a multicast group
-   *
-   * @param addr The group to join
-   *
-   * @exception IOException If an error occurs
-   */
-  static native void join(PlainDatagramSocketImpl socket, InetAddress addr)
-    throws IOException;
-
-  /**
-   * Leaves a multicast group
-   *
-   * @param addr The group to leave
-   *
-   * @exception IOException If an error occurs
-   */
-  static native void leave(PlainDatagramSocketImpl socket, InetAddress addr)
-    throws IOException;
-
-  /**
-   * Joins a multicast group.
-   *
-   * @param socket the socket object
-   * @param address the socket address
-   * @param netIf the network interface
-   *
-   * @throws IOException if I/O errors occur
-   */
-  static void joinGroup(PlainDatagramSocketImpl socket, SocketAddress address,
-                        NetworkInterface netIf)
-    throws IOException
-  {
-    throw new InternalError
-      ("PlainDatagramSocketImpl::joinGroup is not implemented");
-  }
-
-  /**
-   * Leaves a multicast group.
-   *
-   * @param socket the socket object
-   * @param address the socket address
-   * @param netIf the network interface
-   *
-   * @throws IOException if I/O errors occur
-   */
-  static void leaveGroup(PlainDatagramSocketImpl socket, SocketAddress address,
-                         NetworkInterface netIf)
-    throws IOException
-  {
-    throw new InternalError
-      ("PlainDatagramSocketImpl::leaveGroup is not implemented");
-  }
-
-}
Index: vm/reference/gnu/java/net/VMPlainSocketImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/gnu/java/net/VMPlainSocketImpl.java,v
retrieving revision 1.4
diff -u -r1.4 VMPlainSocketImpl.java
--- vm/reference/gnu/java/net/VMPlainSocketImpl.java	17 Sep 2006 07:31:43 -0000	1.4
+++ vm/reference/gnu/java/net/VMPlainSocketImpl.java	8 Oct 2006 23:26:53 -0000
@@ -61,6 +61,10 @@
  */
 public final class VMPlainSocketImpl
 {
+  /** Option id for time to live
+   */
+  private static final int CP_IP_TTL = 0x1E61;
+
   private final State nfd;
   
   /**
@@ -91,6 +95,41 @@
     return nfd;
   }
 
+  /** This method exists to hide the CP_IP_TTL value from
+   * higher levels.
+   *
+   * Always think of JNode ... :)
+   */
+  public void setTimeToLive(int ttl)
+    throws SocketException
+  {
+    try
+      {
+        setOption(nfd.getNativeFD(), CP_IP_TTL, ttl);
+      }
+    catch (IOException ioe)
+      {
+        SocketException se = new SocketException();
+        se.initCause(ioe);
+        throw se;
+      }
+  }
+
+  public int getTimeToLive()
+    throws SocketException
+  {
+    try
+      {
+        return getOption(nfd.getNativeFD(), CP_IP_TTL);
+      }
+    catch (IOException ioe)
+      {
+        SocketException se = new SocketException();
+        se.initCause(ioe);
+        throw se;
+      }
+  }
+
   public void setOption(int optionId, Object optionValue)
     throws SocketException
   {
@@ -402,4 +441,4 @@
         }
     }
   }
-}
\ No newline at end of file
+}
Index: NEWS
===================================================================
RCS file: /cvsroot/classpath/classpath/NEWS,v
retrieving revision 1.169
diff -u -r1.169 NEWS
--- NEWS	20 Sep 2006 22:35:55 -0000	1.169
+++ NEWS	8 Oct 2006 23:26:53 -0000
@@ -39,11 +39,13 @@
 * gnu.java.nio.VMPipe has been similarly changed.
 * gnu.java.net.VMPlainSocketImpl has been changed to remove some
   functionality now provided by VMChannel; datagram socket-specific
-  methods have also been moved here, deprecating
-  VMPlainDatagramSocketImpl.
+  methods have also been moved here, deprecating VMPlainDatagramSocketImpl.
+* gnu.java.net.VMPlainDatagramSocketImpl removed.
 
 New in release 0.92 (Aug 9, 2006)
 
+* GConf is used as a backend for java.util.prefs. GNU Classpath 
+  thanks to Mario Torre for this contribution!
 * libjawtgnu.so has been renamed libjawt.so for binary compatibility.
   libjawt.so should be installed in a VM-specific directory rather
   than directly in /usr/lib.  Proprietary VMs put their libjawt.so

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to