FAQ
When communicating with a tftp server (UDP), the initial datagram goes to a
well-known port on the server, but the server uses an ephemeral port to
respond to the client for subsequent messages and the client is supposed to
use the new ephemeral port number for subsequent messages. But it seems
like the way the net module is designed, it doesn't provide a mechanism to
retrieve this subsequent port number.

Doing localConn.RemoteAddr() where localConn is from one of the Listen
API's does not work (returns a nil interface). Doing
remoteConn.RemoteAddr() where remoteConn is from one of the Dial API's does
not work either because it returns the original well-known port number.

Is there some other method of retrieve this that I am missing?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Sanjay at Apr 23, 2014 at 9:33 pm
    Try using udpConn.ReadFrom(), rather than udpConn.Read(). It will give you
    a net.Addr back.

    Sanjay
    On Wednesday, April 23, 2014 1:04:27 PM UTC-7, sanj...@gmail.com wrote:

    When communicating with a tftp server (UDP), the initial datagram goes to
    a well-known port on the server, but the server uses an ephemeral port to
    respond to the client for subsequent messages and the client is supposed to
    use the new ephemeral port number for subsequent messages. But it seems
    like the way the net module is designed, it doesn't provide a mechanism to
    retrieve this subsequent port number.

    Doing localConn.RemoteAddr() where localConn is from one of the Listen
    API's does not work (returns a nil interface). Doing
    remoteConn.RemoteAddr() where remoteConn is from one of the Dial API's does
    not work either because it returns the original well-known port number.

    Is there some other method of retrieve this that I am missing?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 23, '14 at 9:13p
activeApr 23, '14 at 9:33p
posts2
users2
websitegolang.org

2 users in discussion

Sanjayss: 1 post Sanjay: 1 post

People

Translate

site design / logo © 2021 Grokbase