-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
added getsockname
for determining a socket name (address & port) of the running server
#11012
Conversation
close(sock) | ||
end | ||
|
||
@unix_only begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why this fails on windows? Implementation issue, or OS limitation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appveyor failed of this test on Windows, I guess they do not have IPv6 available on test machine. I'll turn if back. Problem is how to tell if IPv6 is on or not before executing this test. Or should I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Thu, Apr 30, 2015 at 2:17 PM, Art [email protected] wrote:
In test/socket.jl
#11012 (comment):+begin
- default_port = UInt16(11011)
- default_addr = IPv4("127.0.1.1")
- sock = Base.TCPServer()
- bind(sock,Base.InetAddr(default_addr,default_port))
- listen(sock)
- new_addr, new_port = getsockname(sock)
+@unix_only begin
Appveyor failed of this test on Windows, I guess they do not have IPv6
available on test machine. I'll turn if back. Problem is how to tell if
IPv6 is on or not before executing this test. Or should I remove it?—
Reply to this email directly or view it on GitHub
https://github.com/JuliaLang/julia/pull/11012/files#r29455402.
Closed by mistake. |
@wildart , thanks for the PR. Please rebase against current master. While rebasing you will need to delete Lines 693 to 704 in 9c82059
managers.jl accordingly.
|
Since this won't make it into Julia .4, maybe we could carve out the essential part of this PR and move it to JuliaWeb now. |
@malmaud You still need |
Ya, there is nothing technically blocking us from directly addressing libuv in a package, is there? It would just be temporary until the functionality is moved into base in .5. |
@wildart, want to rebase this? Would be cool to get it into .5. |
b65dbf2
to
a40ebc5
Compare
Rebased and fixed errors, it's ready to merge. |
Doc changes here need to be reflected in helpdb |
added `getsockname` for determining a socket name (address & port) of the running server fixed corresponding docimentation added `uv_tcp_getpeername` to `getsockname` for getting the address and the port of the peer connected to the TCP server socket fixed generalizing `bind`, Union() => Union{} fixed AF_INET6 for OSX added docs
f5ec85e
to
37f8943
Compare
Done. |
@@ -893,11 +893,12 @@ System | |||
|
|||
Get the local machine's host name. | |||
|
|||
.. function:: getipaddr() -> AbstractString | |||
.. function:: getipaddr() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be getipaddr() -> IPAddr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crap, it's so good to have duplicate documentations.
Ready. |
(Ptr{Void}, Ref{Cushort}, Ptr{Void}, Ref{Cuint}), | ||
sock.handle, rport, raddress, rfamily) | ||
end | ||
uv_error("cannot obtain socket name", r); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nevermind.
added `getsockname` for determining a socket name (address & port) of the running server
Great, glad to finally have this functionality. |
I added
getsockname
for determining a socket name (address & port) of the running server. When server socket bound toINPORT_ANY
port (0), duringlisten
call the socket is automatically bound to a random free port. By callinggetsockname
, you can get value of the assigned port.In addition, I fixed a missing IPv6 support for
bind
and some documentation.