It should also be noted that way this handles packet ACKs, requires that
you maintain a steady and timed stream of back/forth communication. This
package was mostly written with multiplayer games in mind. In these cases,
you are polling for network activity (usually) once every frame. This
maintains the steady data stream.

Sending/receiving data as fast as possible, outside of a game loop context
can be done as-is, but it does mean that you have send empty (nil payload)
packets on a regular basis in order to keep the ACK synchronisation going.
On Friday, August 31, 2012 3:45:22 PM UTC+2, Jim Teeuwen wrote:

In addition to the out-of-order reception, there is no guarantee that a
packet arrives at all.
UDP does not do retransmission of lost packets.. It has no notion of lost
or received packets at all.

You will need to build a reliability layer on top of UDP to do this.
If guaranteed reception in the right order is something you really need,
it is probably better to just use TCP.

If you do require UDP and don't mind getting your hands dirty, this might
be of some help:

It is still very low level, as it does not automatically resend lost
packets, but it does keep track
of ACK'ed and lost packets for you. It notifies you through an event
handler at which point you
can handle the situation as you want. It should be relatively easy to
build an in-order buffered
reader on top of an xudp.Connection.

On Friday, August 31, 2012 1:24:33 PM UTC+2, Dave Cheney wrote:

While net.UDPConn implements Read(), there is no guarantee that reads
will occur in the same sequence that they were sent. This may be
problem for your use case.
On Fri, Aug 31, 2012 at 6:18 PM, liamzebedee wrote:
Is there any way to buffer reads (read a packet into a bytes.Buffer struct)
from something that implements net.PacketConn (UDP etc.) I wish to just get
the contents of the next packet and put it into a dynamically sized buffer.
If I didn't need the address, I could do it this way.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 7 | next ›
Discussion Overview
groupgolang-nuts @
postedAug 31, '12 at 8:18a
activeSep 1, '12 at 10:35a



site design / logo © 2021 Grokbase