FAQ
Hi all,

Without wanting to dive into raw sockets in Go, is there an easy way I
can't find for the life of me to set the source port of UDP packets in the
net package? Any help would be greatly received. I've checked documentation
for any signs of which (I can't find) and hunted blogs too.

The only reference I found to UDP source port was in a DNS package file. If
any of you know a simple way to set the source ports in UDP packets, that
would be great.

Thanks in advance,
David G

--
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

  • Ian Lance Taylor at May 22, 2016 at 1:44 am

    On Sat, May 21, 2016 at 3:52 PM, wrote:
    Without wanting to dive into raw sockets in Go, is there an easy way I can't
    find for the life of me to set the source port of UDP packets in the net
    package? Any help would be greatly received. I've checked documentation for
    any signs of which (I can't find) and hunted blogs too.

    The only reference I found to UDP source port was in a DNS package file. If
    any of you know a simple way to set the source ports in UDP packets, that
    would be great.
    The net.DialUDP function, which you can use to create a net.UDPConn,
    takes both a local and a remote address.

    https://golang.org/pkg/net/#DialUDP

    Ian

    --
    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.
  • David Gee at May 22, 2016 at 8:48 am
    Thanks Ian. I found I could do it with the laddr option just after I had given up and posted to the list! Typical. I looked at retracting the message or responding to it myself to mark it as solved but couldn't see it.

    Thanks,

    David

    Sent from my handheld device. Please excuse fat finger typos and the brevity of message.

    On 22 May 2016, at 02:44, Ian Lance Taylor wrote:

    On Sat, May 21, 2016 at 3:52 PM, wrote:

    Without wanting to dive into raw sockets in Go, is there an easy way I can't
    find for the life of me to set the source port of UDP packets in the net
    package? Any help would be greatly received. I've checked documentation for
    any signs of which (I can't find) and hunted blogs too.

    The only reference I found to UDP source port was in a DNS package file. If
    any of you know a simple way to set the source ports in UDP packets, that
    would be great.
    The net.DialUDP function, which you can use to create a net.UDPConn,
    takes both a local and a remote address.

    https://golang.org/pkg/net/#DialUDP

    Ian
    --
    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
postedMay 22, '16 at 1:32a
activeMay 22, '16 at 8:48a
posts3
users2
websitegolang.org

2 users in discussion

David Gee: 2 posts Ian Lance Taylor: 1 post

People

Translate

site design / logo © 2021 Grokbase