FAQ
How do I use syscall.Bind to bind a socket to an address? It
requires a Sockaddr type, but there is no way to set an Sockaddr
to a specific address. All you can do is ask for the Sockaddr of
a socket that already has an address.


--
Peter Kleiweg
my Go programming cookbook: http://www.let.rug.nl/~kleiweg/go/

--
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/groups/opt_out.

Search Discussions

  • Georg Reinke at Apr 8, 2013 at 12:03 pm
    All of the Sockaddr* types (e.g., http://golang.org/pkg/syscall/#SockaddrInet4)
    implement the Sockaddr interface, so you can use them for syscall.Bind.

    Also, if possible, you should use the facilities of the net package instead.

    2013/4/8 Peter Kleiweg <pkleiweg@xs4all.nl>:
    How do I use syscall.Bind to bind a socket to an address? It
    requires a Sockaddr type, but there is no way to set an Sockaddr
    to a specific address. All you can do is ask for the Sockaddr of
    a socket that already has an address.


    --
    Peter Kleiweg
    my Go programming cookbook: http://www.let.rug.nl/~kleiweg/go/

    --
    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/groups/opt_out.
    --
    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/groups/opt_out.
  • Maxim Khitrov at Apr 8, 2013 at 12:06 pm
    I think you're meant to use SockaddrInet4, SockaddrInet6, and others,
    which implement the Sockaddr interface.
    On Mon, Apr 8, 2013 at 7:57 AM, Peter Kleiweg wrote:

    How do I use syscall.Bind to bind a socket to an address? It
    requires a Sockaddr type, but there is no way to set an Sockaddr
    to a specific address. All you can do is ask for the Sockaddr of
    a socket that already has an address.
    --
    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/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 8, '13 at 11:57a
activeApr 8, '13 at 12:06p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase