[go-nuts] Correct way to handle errors from net.http?

2020-02-05 Thread Rio
Background: I was writing an HTTP proxy using net.http which supports both HTTP/1 and HTTP/2. I need to detect errors and do correct things according to RFC (https://http2.github.io/http2-spec/#CONNECT). It turns out that net.http has its own bundled copy of x/net/http2 (https://golang.org/src

Re: [go-nuts] Goroutines, Nonblocking I/O, And Memory Usage

2018-03-15 Thread Rio
On Friday, March 16, 2018 at 1:05:12 AM UTC+8, Ian Lance Taylor wrote: > > > That's inherently racy, though. It's quite normal to have multiple > goroutines reading from the same socket. That is awkward if we split > up WaitRead and Read. Better to have a single wait-then-read > operation,

Re: [go-nuts] Goroutines, Nonblocking I/O, And Memory Usage

2018-03-15 Thread Rio
On Thursday, March 15, 2018 at 4:23:41 AM UTC+8, Bakul Shah wrote: > > > You will need 10K*64KiB*2 = 1.22GiB kernel bufferspace at a > minimum in any case. That is still one datagram's worth of > buffering per UDP socket so you can still lose some packets. > This is in addition to any user lev

Re: [go-nuts] Goroutines, Nonblocking I/O, And Memory Usage

2018-03-15 Thread Rio
On Thursday, March 15, 2018 at 3:37:51 AM UTC+8, Ian Lance Taylor wrote: > > > Even for TCP, that's an interesting point. I wonder if we should have > a way to specify a number of bytes to read such that we only allocate > the []byte when there is something to read. > I was thinking a better

[go-nuts] Goroutines, Nonblocking I/O, And Memory Usage

2018-03-14 Thread Rio
While implementing a SOCKS proxy in Go, I ran into an issue which is better explained in details by Evan Klitzke in this post https://eklitzke.org/goroutines-nonblocking-io-and-memory-usage In my case, each proxied connection costs two goroutines and two buffers in blocking read. For TCP conne

Re: [go-nuts] How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
ead. > This won't be efficient in a tight loop, but if you know a point where may > clients idle it may be worth it. > > //jb > > > On 6 Mar 2017, at 09:26, Nick Rio > > wrote: > > > > The application is working right now. Current work for me

Re: [go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
re - New Orleans LA > > > > *From:* golan...@googlegroups.com [mailto: > golan...@googlegroups.com ] *On Behalf Of *Nick Rio > *Sent:* 2017 March 06, Mon 02:26 > *To:* golang-nuts > *Subject:* Re: [go-nuts] Re: How can I implement a TCP server using a > model which simila

Re: [go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
Hi Konstantin, Thank you for the hit. I'll look into it. On Monday, March 6, 2017 at 5:25:47 PM UTC+8, Konstantin Khomoutov wrote: > > On Mon, 6 Mar 2017 12:01:43 +0300 > Konstantin Khomoutov > wrote: > > > > The application is working right now. Current work for me is to > > > found a way to

Re: [go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
t; > > *From:* golan...@googlegroups.com [mailto: > golan...@googlegroups.com ] *On Behalf Of *Nick Rio > *Sent:* 2017 March 05, Sun 23:28 > *To:* golang-nuts > *Subject:* [go-nuts] Re: How can I implement a TCP server using a model > which similar to epoll (or kqueue, IOCP) rather than ju

[go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-05 Thread Nick Rio
Thank you for reply. No guys, it's me using too many memories, not Goroutine. However, I believe if I can make those code in epoll-style, I can then build a task queue to handle those connections one by one in a queue when they back to active. For example, start one *accepter* goroutine + few

[go-nuts] [Beginner question] Which language supports more concurrency models: Go or Java?

2017-02-05 Thread yinsi . rio
not very familiar with Go, but here's what I found: - CSP: built in into the language - Actor model: Proto Actor <http://proto.actor/> - I probably missed a lot of things, so feel free to correct me Thank you in advance, Rio -- You received this message because you are

[go-nuts] Implementing io.ReaderFrom and io.WriterTo interfaces and dealing with errors (especially io.EOF)

2017-01-29 Thread Rio
Current doc says ReadFrom reads data from r until EOF or error. The return value n is the > number of bytes read. Any error except io.EOF encountered during the read > is also returned. WriteTo writes data to w until there's no more data to write or when an > error occurs. The return value n

[go-nuts] Re: GUI for Go

2016-07-01 Thread Rio M
I hope for project based on Javascript+Golang server (like http://electron.atom.io/). -- 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...@go