Re: [go-nuts] golang tcp transport just like nc

2018-03-08 Thread Jamil Djadala
On Wed, 7 Mar 2018 19:16:33 -0800 (PST) sucong...@gmail.com wrote: > > > linux nc command port to golang > > > in nc , we can do this > > echo 'my id is 1' > /tmp/1 > echo 'my id is 3' > /tmp/3 > rm -rf /tmp/2 /tmp/4 > > > > server > > nc -l 19090 < /tmp/1 > /tmp/2 > > ( if you are in l

Re: [go-nuts] golang tcp transport just like nc

2018-03-08 Thread Peter Waller
Once you've read all of os.Stdin, and the io.Copy finishes, you need to call conn.CloseWrite(), to signal to the other side that it won't receive any more bytes. Otherwise each side is blocked in io.Copy(os.Stdout, conn) waiting for more bytes to arrive from the other side. -- You received this m

[go-nuts] golang tcp transport just like nc

2018-03-07 Thread suconghou
linux nc command port to golang in nc , we can do this echo 'my id is 1' > /tmp/1 echo 'my id is 3' > /tmp/3 rm -rf /tmp/2 /tmp/4 server nc -l 19090 < /tmp/1 > /tmp/2 ( if you are in linux not mac this may be ` nc -l -p 19090 ` ) client nc 127.0.0.1 19090 < /tmp/3 > /tmp/4 when fi