< prev index next >

src/jdk.jdwp.agent/windows/native/libdt_socket/socket_md.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -22,10 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 #include <windows.h>
 #include <winsock2.h>
+#include <ws2tcpip.h>
 
 #include "sysSocket.h"
 #include "socketTransport.h"
 
 typedef jboolean bool_t;

@@ -195,13 +196,15 @@
 int
 dbgsysSend(int fd, char *buf, size_t nBytes, int flags) {
     return send(fd, buf, (int)nBytes, flags);
 }
 
-struct hostent *
-dbgsysGetHostByName(char *hostname) {
-    return gethostbyname(hostname);
+int
+dbgsysGetAddrInfo(char *hostname, char *service,
+                  struct addrinfo *hints,
+                  struct addrinfo **result) {
+  return getaddrinfo(hostname, service, hints, result);
 }
 
 unsigned short
 dbgsysHostToNetworkShort(unsigned short hostshort) {
     return htons(hostshort);

@@ -221,11 +224,11 @@
     struct linger l;
     int len = sizeof(l);
 
     if (getsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) {
         if (l.l_onoff == 0) {
-            WSASendDisconnect(fd, NULL);
+            shutdown(fd, SD_SEND);
         }
     }
     return closesocket(fd);
 }
 

@@ -237,11 +240,13 @@
 }
 
 
 uint32_t
 dbgsysInetAddr(const char* cp) {
-    return (uint32_t)inet_addr(cp);
+    uint32_t addr;
+    inet_pton(AF_INET, cp, &addr);
+    return addr;
 }
 
 uint32_t
 dbgsysHostToNetworkLong(uint32_t hostlong) {
     return (uint32_t)htonl((u_long)hostlong);
< prev index next >