Skip to content

Instantly share code, notes, and snippets.

@martinomburajr
Last active May 14, 2019 05:09
Show Gist options
  • Select an option

  • Save martinomburajr/c38e075dce60becb4df2df568b23aff5 to your computer and use it in GitHub Desktop.

Select an option

Save martinomburajr/c38e075dce60becb4df2df568b23aff5 to your computer and use it in GitHub Desktop.
The Writer implementation of net.Conn
// Write implements the Conn Write method.
func (c *conn) Write(b []byte) (int, error) {
if !c.ok() {
return 0, syscall.EINVAL
}
n, err := c.fd.Write(b)
if err != nil {
err = &OpError{
Op: "write",
Net: c.fd.net,
Source: c.fd.laddr,
Addr: c.fd.raddr,
Err: err}
}
return n, err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment