FAQ
Hey guys, I don't know the term for this - thus it has been hard to google.
I've got a server listening on a specific port, and the clients know that
port number - communication is through RPC (after the original connection)
I want to accept new connections on the original port, then move them to
another port so that the original port can continue listening.

How would one go about that? Whats the term for that?

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

  • Justin Israel at Feb 15, 2015 at 6:34 am
    Why can't it just continue serving the traffic on the same port? The server
    should be able to continue accepting more clients after the first.
    On Sun, 15 Feb 2015 7:29 PM Jonathan Stiansen wrote:

    Hey guys, I don't know the term for this - thus it has been hard to
    google.
    I've got a server listening on a specific port, and the clients know that
    port number - communication is through RPC (after the original connection)
    I want to accept new connections on the original port, then move them to
    another port so that the original port can continue listening.

    How would one go about that? Whats the term for that?

    --
    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.
    --
    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.
  • Jonathan Stiansen at Feb 15, 2015 at 6:37 am
    Perhapa its an issue with my understanding, I'll list my steps.

    My server listens for a connection.
    When a connection arrives (I believe) it blocks my listener. So :

    l, err := net.listen("tcp", ipPort)
    for{
    conn, _ := l.Accept()
    go roc.ServceConn(conn)
    }
    Seems to leave my port at ipPort 'blocked' I thought it's because of
    server, but possibly its because of listen.
    On Saturday, February 14, 2015 at 10:34:18 PM UTC-8, Justin Israel wrote:

    Why can't it just continue serving the traffic on the same port? The
    server should be able to continue accepting more clients after the first.

    On Sun, 15 Feb 2015 7:29 PM Jonathan Stiansen <jonathan...@gmail.com
    <javascript:>> wrote:
    Hey guys, I don't know the term for this - thus it has been hard to
    google.
    I've got a server listening on a specific port, and the clients know that
    port number - communication is through RPC (after the original connection)
    I want to accept new connections on the original port, then move them to
    another port so that the original port can continue listening.

    How would one go about that? Whats the term for that?

    --
    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...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    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.
  • Jonathan Stiansen at Feb 15, 2015 at 6:39 am
    Perhapa its an issue with my understanding, I'll list my steps.

    My server listens for a connection.
    When a connection arrives (I believe) it blocks my listener. So :

    l, err := net.listen("tcp", ipPort)
    for{
    conn, _ := l.Accept()
    go roc.ServceConn(conn)
    }
    Seems to leave my port at ipPort 'blocked' I thought it's because of
    server, but possibly its because of listen.
    On Saturday, February 14, 2015 at 10:34:18 PM UTC-8, Justin Israel wrote:

    Why can't it just continue serving the traffic on the same port? The
    server should be able to continue accepting more clients after the first.

    On Sun, 15 Feb 2015 7:29 PM Jonathan Stiansen <jonathan...@gmail.com
    <javascript:>> wrote:
    Hey guys, I don't know the term for this - thus it has been hard to
    google.
    I've got a server listening on a specific port, and the clients know that
    port number - communication is through RPC (after the original connection)
    I want to accept new connections on the original port, then move them to
    another port so that the original port can continue listening.

    How would one go about that? Whats the term for that?

    --
    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...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    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.
  • Justin Israel at Feb 15, 2015 at 10:25 am
    You should be able to keep accepting new connections, as you hand of the
    serving of each one to their own goroutines. Your pattern looks the same as
    what net/http is doing in ListenAndServe :
    https://golang.org/src/net/http/server.go#L1709
    On Sun, 15 Feb 2015 7:39 PM Jonathan Stiansen wrote:


    Perhapa its an issue with my understanding, I'll list my steps.

    My server listens for a connection.
    When a connection arrives (I believe) it blocks my listener. So :

    l, err := net.listen("tcp", ipPort)
    for{
    conn, _ := l.Accept()
    go roc.ServceConn(conn)
    }
    Seems to leave my port at ipPort 'blocked' I thought it's because of
    server, but possibly its because of listen.
    On Saturday, February 14, 2015 at 10:34:18 PM UTC-8, Justin Israel wrote:

    Why can't it just continue serving the traffic on the same port? The
    server should be able to continue accepting more clients after the first.

    On Sun, 15 Feb 2015 7:29 PM Jonathan Stiansen <jonathan...@gmail.com>
    wrote:
    Hey guys, I don't know the term for this - thus it has been hard to
    google.
    I've got a server listening on a specific port, and the clients know
    that port number - communication is through RPC (after the original
    connection) I want to accept new connections on the original port, then
    move them to another port so that the original port can continue listening.

    How would one go about that? Whats the term for that?

    --
    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...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    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.
    --
    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.
  • Kevin Malachowski at Feb 16, 2015 at 12:10 am
    In most (maybe all?) tcp implementations the server does indeed assign a new port to the connection when it Accepts it. This way other clients may continue to connect using the same port, the functionality you want. Try printing out the local address information from the connection returned from Accept.

    --
    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.
  • Ian Lance Taylor at Feb 16, 2015 at 4:27 am

    On Sun, Feb 15, 2015 at 4:09 PM, Kevin Malachowski wrote:
    In most (maybe all?) tcp implementations the server does indeed assign a new port to the connection when it Accepts it. This way other clients may continue to connect using the same port, the functionality you want. Try printing out the local address information from the connection returned from Accept.
    No, it's the same local port number. The key is that each TCP
    connection is determined by four numbers: local IP address, local port
    number, remote IP address, remote port number. So you can many TCP
    connections to the same local port on your system, as long as they
    each have a different remote IP address and/or different remote port.

    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
postedFeb 15, '15 at 6:29a
activeFeb 16, '15 at 4:27a
posts7
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase