Closed vtolstov closed 7 years ago
All the NewSocket* functions either listen, or take an already listening Conn. NewSocket is the utp package's Listen. The reason for the differing type is that a Socket is both a net.Listener, and a net.PacketConn.
Perhaps I should clear this up by improving the doc.
Thanks! But why not create Listen method, that run NewSocket and returns net.Listener interface?
That seems like a good compromise. Make a PR if you wish.
please check #21
Also note, why you hardcoded udp in all places and not create ability to specify udp4, udp, udp6 ? If i create pr, does it acceptable ?
I think because NewSocket is just a convenience, utp just wraps a net.PacketConn, so if you want full control, that's the way to go, with NewSocketFromPacketConn.
If i want to listen on utp packets, what i need to do? As i see package does not have Listen method, so i need to listen udp specific port and use NewSocketFromPacketConn? Does does it possible to create Listen method?