You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The net package has some good examples for writing socket servers, but it doesn't provide a full example for a robust echo server that reads all data from clients around errors and EOFs.
io.Reader's docs say:
When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == nil. The next Read should return 0, EOF.
This is something that's not hard to demonstrate with fairly little amount of code, and a robust socket echo server would make a good example.
The text was updated successfully, but these errors were encountered:
At a glance the linked example looks like it's headed in the right direction. An example would need to be edited for concision, style, and have commentary in line with the rest of the site, and be introduced as a PR against this repo. I don't personally have time to work on that right now, but if someone else does feel free to go for it!
The
net
package has some good examples for writing socket servers, but it doesn't provide a full example for a robust echo server that reads all data from clients around errors and EOFs.io.Reader
's docs say:This is something that's not hard to demonstrate with fairly little amount of code, and a robust socket echo server would make a good example.
The text was updated successfully, but these errors were encountered: