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

[request] UDP transport #168

Closed
liamstask opened this issue Dec 27, 2017 · 11 comments
Closed

[request] UDP transport #168

liamstask opened this issue Dec 27, 2017 · 11 comments

Comments

@liamstask
Copy link
Contributor

breaking out as distinct from #107

Would be great to make unreliable datagrams available as a transport option.

@gdamore
Copy link
Contributor

gdamore commented Dec 27, 2017

Thanks, I'll keep this on the table. Its not a strong priority for me at the present, but definitely something it would be nice to have.

@liamstask
Copy link
Contributor Author

looking at this a bit - main uncertainty has to do with the fact that the existing platform udp code does not correspond to the ep/pipe api in the way that, say, the tcp platform code does.

do you think it would make sense to adjust the udp platform code to implement nni_plat_udp_ep_* and nni_plat_udp_pipe_*?

if that were in place, it looks like it would not be too bad to create the udp transport as follows:

static nni_tran_pipe nni_udp_pipe_ops = {
	.p_fini    = nni_udp_pipe_fini,
	.p_start   = nni_udp_pipe_start,
	.p_send    = nni_udp_pipe_send,
	.p_recv    = nni_udp_pipe_recv,
	.p_close   = nni_udp_pipe_close,
	.p_peer    = nni_udp_pipe_peer,
	.p_options = nni_udp_pipe_options,
};

static nni_tran_ep nni_udp_ep_ops = {
	.ep_init    = nni_udp_ep_init,
	.ep_fini    = nni_udp_ep_fini,
	.ep_connect = NULL,
	.ep_bind    = nni_udp_ep_bind,
	.ep_accept  = NULL,
	.ep_close   = nni_udp_ep_close,
	.ep_options = nni_udp_ep_options,
};

static nni_tran nni_udp_tran = {
	.tran_version = NNI_TRANSPORT_VERSION,
	.tran_scheme  = "udp",
	.tran_ep      = &nni_udp_ep_ops,
	.tran_pipe    = &nni_udp_pipe_ops,
	.tran_init    = nni_udp_tran_init,
	.tran_fini    = nni_udp_tran_fini,
};

does that make sense? do you have another approach in mind?

@gdamore
Copy link
Contributor

gdamore commented Mar 5, 2018

I've been thinking about the semantic for UDP (may have a commercial customer that needs it), stay tuned.

@itsermo
Copy link

itsermo commented Nov 26, 2019

any updates on this?

i'm looking at using nanomsg for a project, but one of my requirements is to have a UDP-based option when i don't care about reliability, but want to communicate with computers across networked equipment in a lowest-latency fashion

@KenthJohan
Copy link

Looking forward of UDP integration. In many cases I would rather have UDP drop packages than getting late data from TCP.
UDP is more reliable as regards on time in low latency real time systems.

@jeinstei
Copy link

Ditto on this -- I've been unable to easily find good UDP protocols, and it really would be nice to have something that isn't custom every time for embedded real-time applications.

@devlpr
Copy link

devlpr commented Apr 27, 2022

Same. I'd really like to use nng but I cannot because we really need UDP.

@mjmvisser
Copy link

mjmvisser commented Feb 28, 2023

I'm honestly shocked UDP isn't supported out-of-the-box. It's the standard for realtime protocols that care more about latency than reliability.

Edit: so it looks like low-level UDP platform support is already in place. @gdamore do you have opinions on the public API? I'm tempted to just go ahead and implement it. Digging into it, it seems it's just adding "udp4" and "udp6" schemes (also "dtls" for datagram tls?) and implementing dialer/listener., so there's no change to any public API.

@esemeniuc
Copy link

would love to see udp added

@gdamore
Copy link
Contributor

gdamore commented Sep 29, 2024

I have a draft implementation (very rough) and a spec. Initially this is just unicast, but I intend to add mesh support.

gdamore added a commit that referenced this issue Sep 29, 2024
This is the initial implementation of UDP transport.
It does in order guarantees (and consequently filters duplicates),
but it does not guarantee delivery.  The protocol limits payloads
to 65000 bytes (minus headers for SP), but you really want to
keep it to much less -- probably best for short messages that within
a single MTU to avoid IP fragmentation and reassembly.

This is unicast only for now (although there are plans for some
support for multicast and broadcast as well as being able to
perform automatic mesh building, but that will be in following work.

Additional tunables are coming.  This is only lightly tested at
this point, and should be considered experimental.  Its also undocumented.
@gdamore
Copy link
Contributor

gdamore commented Sep 29, 2024

For NNG 2.0 (development branch, see dev2.0) I have a PR that adds this -- see #168 - although be advised its a work in progress. There is also a draft specification at nanomsg/rfcs#1

gdamore added a commit that referenced this issue Sep 29, 2024
This is the initial implementation of UDP transport.
It does in order guarantees (and consequently filters duplicates),
but it does not guarantee delivery.  The protocol limits payloads
to 65000 bytes (minus headers for SP), but you really want to
keep it to much less -- probably best for short messages that within
a single MTU to avoid IP fragmentation and reassembly.

This is unicast only for now (although there are plans for some
support for multicast and broadcast as well as being able to
perform automatic mesh building, but that will be in following work.

Additional tunables are coming.  This is only lightly tested at
this point, and should be considered experimental.  Its also undocumented.
gdamore added a commit that referenced this issue Sep 29, 2024
This is the initial implementation of UDP transport.
It does in order guarantees (and consequently filters duplicates),
but it does not guarantee delivery.  The protocol limits payloads
to 65000 bytes (minus headers for SP), but you really want to
keep it to much less -- probably best for short messages that within
a single MTU to avoid IP fragmentation and reassembly.

This is unicast only for now (although there are plans for some
support for multicast and broadcast as well as being able to
perform automatic mesh building, but that will be in following work.

Additional tunables are coming.  This is only lightly tested at
this point, and should be considered experimental.  Its also undocumented.
gdamore added a commit that referenced this issue Oct 5, 2024
This is the initial implementation of UDP transport.
It does in order guarantees (and consequently filters duplicates),
but it does not guarantee delivery.  The protocol limits payloads
to 65000 bytes (minus headers for SP), but you really want to
keep it to much less -- probably best for short messages that within
a single MTU to avoid IP fragmentation and reassembly.

This is unicast only for now (although there are plans for some
support for multicast and broadcast as well as being able to
perform automatic mesh building, but that will be in following work.

Additional tunables are coming.  This is only lightly tested at
this point, and should be considered experimental.  Its also undocumented.
gdamore added a commit that referenced this issue Oct 6, 2024
This is the initial implementation of UDP transport.
It does in order guarantees (and consequently filters duplicates),
but it does not guarantee delivery.  The protocol limits payloads
to 65000 bytes (minus headers for SP), but you really want to
keep it to much less -- probably best for short messages that within
a single MTU to avoid IP fragmentation and reassembly.

This is unicast only for now (although there are plans for some
support for multicast and broadcast as well as being able to
perform automatic mesh building, but that will be in following work.

Additional tunables are coming.  This is only lightly tested at
this point, and should be considered experimental.  Its also undocumented.
@gdamore gdamore closed this as completed in f89f8f5 Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants