[PATCH] [Attn Adam] Migrate libgcj to WinSock 2 on Windows

Ranjit Mathew rmathew@hotmail.com
Sun Oct 27 07:11:00 GMT 2002


Hi,

     The current libgcj on Windows uses a mix of both WinSock 1.1
and WinSock 2 (provided by wsock32.dll and ws2_32.dll respectively).
This is not consistent (for example, the values of IP_MULTICAST_TTL,
etc. are different on both) and is also redundant. Moreover,
WinSock 2 is a better implementation of TCP/IP and other
protocols. More info on WinSock 2 can be found at:

     http://www.sockets.com/winsock2.htm

WinSock 2 is also available on almost all Win32 versions except
on WinNT 3.51 - for Windows 95 it is readily available from:

http://www.microsoft.com/windows95/downloads/contents/WUAdminTools/S_WUNetworkingTools/W95Sockets2/Default.asp

(in case the user has a vanilla box without IE, etc.)

The following patch attempts to fix this "anamoly" - I've tested
this with GCJ 3.2. It assumes that at least MinGW/Cygwin w32api 2.0
is available during the build. If we wish to live with the fact
that WinNT 3.51 will not be supported, we should consider applying
this patch.

ChangeLog:

2002-10-27  Ranjit Mathew <rmathew@hotmail.com>

         * include/win32.h, configure.in, java/net/natInetAddress.cc,
         java/net/natPlainSocketImpl.cc, java/net/natNetworkInterface.cc:
         Migrate to, and consistently use, WinSock 2 on Windows.

------------------------------- 8< ---------------------------------
--- libjava/include/win32.h	Sun Oct 27 20:19:42 2002
+++ libjava/include/win32.h	Sun Oct 27 20:21:04 2002
@@ -15,7 +15,5 @@
  #undef STRICT

-#undef __INSIDE_CYGWIN__
-#include <winsock.h>
-#define IP_TOS 3
+#include <ws2tcpip.h>
  #include <gcj/cni.h>
  #include <java/util/Properties.h>
--- libjava/java/net/natInetAddress.cc	Sun Oct 27 20:21:24 2002
+++ libjava/java/net/natInetAddress.cc	Sun Oct 27 20:21:34 2002
@@ -14,5 +14,5 @@

  #include <windows.h>
-#include <winsock.h>
+#include <winsock2.h>
  #undef STRICT

--- libjava/java/net/natNetworkInterface.cc	Sun Oct 27 20:21:24 2002
+++ libjava/java/net/natNetworkInterface.cc	Sun Oct 27 20:21:56 2002
@@ -14,5 +14,5 @@

  #include <windows.h>
-#include <winsock.h>
+#include <winsock2.h>
  #undef STRICT

--- libjava/java/net/natPlainSocketImpl.cc	Sun Oct 27 20:21:24 2002
+++ libjava/java/net/natPlainSocketImpl.cc	Sun Oct 27 20:21:46 2002
@@ -13,5 +13,5 @@
  #ifdef WIN32
  #include <windows.h>
-#include <winsock.h>
+#include <winsock2.h>
  #include <errno.h>
  #include <string.h>
--- libjava/configure.in	Sun Oct 27 20:19:26 2002
+++ libjava/configure.in	Sun Oct 27 20:19:32 2002
@@ -272,5 +272,5 @@
  case "${host}" in
      *mingw*)
-      SYSTEMSPEC="-lgdi32 -lwsock32 -lws2_32"
+      SYSTEMSPEC="-lgdi32 -lws2_32"
      ;;
      *)
------------------------------- 8< ---------------------------------

Sincerely Yours,
Ranjit.

-- 
Ranjit Mathew        Email: rmathew AT hotmail DOT com
Bangalore,
INDIA.               Web: http://ranjitmathew.tripod.com/





More information about the Java-patches mailing list