Commit ca56bb08 authored by Kirill Smelkov's avatar Kirill Smelkov

xnet/pipenet: TODO to fixit for TCP semantic

On TCP port(accepted) = port(listen), i.e.  When we connect
www.nexedi.com:80, remote addr of socket will have port 80.  Likewise on
server side accepted socket will have local port 80.  The connection
should be thus fully identified by src-dst address pair.

However currently pipenet, when accepting connection, allocates another
free port at acceptor side.
parent 8e09e376
......@@ -28,16 +28,21 @@
// h1 := net.Host("abc")
// h2 := net.Host("def")
//
// l, err := h1.Listen(":10") // starts listening on address "abc:10"
// l, err := h1.Listen(":10") // starts listening on address "abc:10"
// go func() {
// csrv, err := l.Accept() // csrv will have LocalAddr "abc:10"
// csrv, err := l.Accept() // csrv will have LocalAddr "abc:1"
// }()
// ccli, err := h2.Dial("abc:10") // ccli will have RemoteAddr "def:10"
// ccli, err := h2.Dial(ctx, "abc:10") // ccli will be connection between "def:1" - "abc:1"
//
// Pipenet might be handy for testing interaction of networked applications in 1
// process without going to OS networking stack.
package pipenet
// TODO Fix pipenet for TCP semantic: there port(accepted) = port(listen), i.e.
// When we connect www.nexedi.com:80, remote addr of socket will have port 80.
// Likewise on server side accepted socket will have local port 80.
// The connection should be thus fully identified by src-dst address pair.
import (
"context"
"errors"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment