New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPv6 support under Windows #5676
Comments
Comment author: @protz Thanks! I'll give the patch a try tomorrow and commit on trunk barring any major problems. |
Comment author: @protz Disclaimer: I'm not a Unix system programming guru, esp. under Windows, so please bear with me, but, I just gave this patch a try and it doesn't seem to work fully. open Unix;;let a = inet_addr_of_string "2001:6b0:5:1688::200";;val a : Unix.inet_addr = let a = ADDR_INET (a, 8001);;val a : Unix.sockaddr = ADDR_INET (, 8001) let ic, oc = open_connection a;;Exception: Unix.Unix_error (EAFNOSUPPORT, "connect", ""). Is that expected? |
Comment author: vouillon I missed this function... I have uploaded an updated patch. |
Comment author: @protz So I gave your patch a try and everything seems to compile/work fine as far as my light testing could tell. Here's a few remarks on the patch:
Apart from that, the patch looks very good! Thanks, jonathan |
Comment author: vouillon
I'm only using "#if defined()" in win32unix/socket.c, and that's
"unixsupport.h" used to include <winsock.h>, and I've changed it An alternative would have been to remove the inclusion of Another alternative would be to move the inclusion of <windows.h> to
In "winworker.h", <winsock2.h> needs to be included between So, I have moved the inclusion of "unixsupport.h" there and
There were some missing includes, including this one. Indeed, Here, times.c uses function alloc_small which is declared in <alloc.h>.
A set_close_on_exec was added in unix/unix.ml in revision 6420 It seems more coherent to have it as well under Windows. Do you want separate patches for the additional includes (such as |
Comment author: @protz Thanks for the extensive explanations and the bonus cleanups. Everything seems just fine so I just commited this on trunk as r12710 Cheers, jonathan |
Original bug ID: 5676
Reporter: vouillon
Assigned to: @protz
Status: closed (set by @xavierleroy on 2015-12-11T18:08:09Z)
Resolution: fixed
Priority: normal
Severity: feature
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: platform support (windows, cross-compilation, etc)
Related to: #5766
Parent of: #5398
Bug description
This patch (against trunk) adds IPv6 support under Windows.
Windows XP is required for compiling OCaml with IPv6 support. Compiled programs should work with older versions of Windows as well.
There are a lot of include order changes, as winsock2.h needs to be included before winsock.h.
The getnameinfo and getaddrinfo bindings are taken from the unix/ directory.
string_of_inet_addr and inet_addr_of_string are implemented using getnameinfo and getaddrinfo, as functions inet_pton and inet_ntop are only available in very recent versions of Windows.
Finally, the check for PF_INET6 in file socket.c is disabled. (By the way, the comment seems incorrect, as OCaml is already linked against Winsock 2.)
File attachments
The text was updated successfully, but these errors were encountered: