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 linux not mac this may be  ` nc -l -p 19090 `  )
> 
> client
> 
> 
> nc 127.0.0.1 19090 < /tmp/3 > /tmp/4
> 
> 
> when finish ,both server and client will be closed
> 
> client send /tmp/3 is saved by server to /tmp/2
> 
> server send /tmp/1 is saved by server to /tmp/4
> 
> then use golang do the same thing , but when finished , both server
> and client can not closed automaticly
> 
> 
> 
> echo 'my id is 1' > /tmp/1
> echo 'my id is 3' > /tmp/3
> rm -rf /tmp/2 /tmp/4
> 
> 
> 
> 
> 
> ./nc serer < /tmp/1 > /tmp/2
> 
> 
> 
> ./nc  < /tmp/3 > /tmp/4
> 
> 
> 
> please help me how to solve this and works like nc 
> 
> 
> example code 
> 
> https://gist.github.com/suconghou/a1bfab9a30b3408400b6382d73051227
> 
> 
> 

See
https://play.golang.org/p/6ljoK4EB9iY

You must use CloseRead/CloseWrite

Jamil Djadala


-- 
Jamil Djadala

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to