Skip to content
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

RFC: udp recvfrom #9418

Merged
merged 3 commits into from
Jan 6, 2015
Merged

RFC: udp recvfrom #9418

merged 3 commits into from
Jan 6, 2015

Conversation

ihnorton
Copy link
Member

Fixes #8901 (also ref #5772). @Keno

I'm open to suggestions on better ways to handle the IP4/6 duality. (another approach would be to store the binding address type in UDPSocket and branch based on that)

Not really sure what the overhead is for adding these function calls inside the callback. The issue is that the the addr::Ptr{Void} argument is only valid for the life of the callback, which necessitates deciding what it is pointing to and copying that out.

cc @jech

@ihnorton ihnorton force-pushed the udp_recvfrom branch 2 times, most recently from 108578b to e10dd2b Compare December 20, 2014 23:55
@ihnorton
Copy link
Member Author

This PR would add the following export: recvfrom(::UDPSocket) -> (addr, data) where addr will be either IPv4 or IPv6 depending on the source host. Any suggestions or objections?

A possible alternative would be to have two functions: recvfrom / recvfrom6.

(edit: re-worded the above comment to make clear what "any suggestions/objections?" is referring to).

@jech
Copy link

jech commented Dec 22, 2014

This PR would add the following export: recvfrom(::UDPSocket) -> (addr, data)
where addr will be either IPv4 or IPv6 depending on the source host. A
possible alternative would be to have two functions: recvfrom / recvfrom6.
Any suggestions or objections?

Just a single function, please.

-- Juliusz

@ihnorton
Copy link
Member Author

ihnorton commented Jan 4, 2015

I wanted to know if there is any performance difference from the additions to _uv_hook_recv. This is my (admittedly unsophisticated - suggestions welcome) test setup:

julia> @async begin
           s = UDPSocket()
           bind(s, ip"0.0.0.0", 10000)
           while true
               b = recv(s)
           end
       end

On master:

isaiah@titan:/cmn/jldev/test$ iperf -u -c 127.0.0.1 -p 10000 -b 10G -t 30
------------------------------------------------------------
Client connecting to 127.0.0.1, UDP port 10000
Sending 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 56863 connected with 127.0.0.1 port 10000
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-30.0 sec  2.82 GBytes   808 Mbits/sec
[  3] Sent 2060762 datagrams
[  3] WARNING: did not receive ack of last datagram after 10 tries.

With this PR:

isaiah@titan:/cmn/jldev/test$ iperf -u -c 127.0.0.1 -p 10000 -b 10G -t 30
------------------------------------------------------------
Client connecting to 127.0.0.1, UDP port 10000
Sending 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 38491 connected with 127.0.0.1 port 10000
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-30.0 sec  2.82 GBytes   808 Mbits/sec
[  3] Sent 2061876 datagrams
[  3] WARNING: did not receive ack of last datagram after 10 tries.

(repeated several times with consistent results)

@ihnorton
Copy link
Member Author

ihnorton commented Jan 4, 2015

So, that being the case, I'll merge in a day or so if there are no objections. (appveyor failure is unrelated)

ihnorton added a commit that referenced this pull request Jan 6, 2015
Add UDP recvfrom support (packet source addresses)
@ihnorton ihnorton merged commit 016ade9 into JuliaLang:master Jan 6, 2015
@ihnorton ihnorton deleted the udp_recvfrom branch January 6, 2015 05:15
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c360a8a on ihnorton:udp_recvfrom into * on JuliaLang:master*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No recvfrom in socket.jl
3 participants