Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
8729d158
Commit
8729d158
authored
Feb 21, 2012
by
Brad Fitzpatrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: more docs on deadlines
Fixes #2777 R=golang-dev, r CC=golang-dev
https://golang.org/cl/5685060
parent
dc19b94b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
src/pkg/net/net.go
src/pkg/net/net.go
+19
-10
No files found.
src/pkg/net/net.go
View file @
8729d158
...
@@ -7,8 +7,10 @@ Package net provides a portable interface for network I/O, including
...
@@ -7,8 +7,10 @@ Package net provides a portable interface for network I/O, including
TCP/IP, UDP, domain name resolution, and Unix domain sockets.
TCP/IP, UDP, domain name resolution, and Unix domain sockets.
Although the package provides access to low-level networking
Although the package provides access to low-level networking
primitives, most clients will need only the basic interface
primitives, most clients will need only the basic interface provided
provided by the Dial, Listen, and Accept functions.
by the Dial, Listen, and Accept functions and the associated
Conn and Listener interfaces. The crypto/tls package uses
the same interfaces and similar Dial and Listen functions.
The Dial function connects to a server:
The Dial function connects to a server:
...
@@ -73,21 +75,28 @@ type Conn interface {
...
@@ -73,21 +75,28 @@ type Conn interface {
RemoteAddr
()
Addr
RemoteAddr
()
Addr
// SetDeadline sets the read and write deadlines associated
// SetDeadline sets the read and write deadlines associated
// with the connection.
// with the connection. It is equivalent to calling both
// SetReadDeadline and SetWriteDeadline.
//
// A deadline is an absolute time after which I/O operations
// fail with a timeout (see type Error) instead of
// blocking. The deadline applies to all future I/O, not just
// the immediately following call to Read or Write.
//
// An idle timeout can be implemented by repeatedly extending
// the deadline after successful Read or Write calls.
//
// A zero value for t means I/O operations will not time out.
SetDeadline
(
t
time
.
Time
)
error
SetDeadline
(
t
time
.
Time
)
error
// SetReadDeadline sets the deadline for all Read calls to return.
// SetReadDeadline sets the deadline for Read calls.
// If the deadline is reached, Read will fail with a timeout
// (see type Error) instead of blocking.
// A zero value for t means Read will not time out.
// A zero value for t means Read will not time out.
SetReadDeadline
(
t
time
.
Time
)
error
SetReadDeadline
(
t
time
.
Time
)
error
// SetWriteDeadline sets the deadline for all Write calls to return.
// SetWriteDeadline sets the deadline for Write calls.
// If the deadline is reached, Write will fail with a timeout
// (see type Error) instead of blocking.
// A zero value for t means Write will not time out.
// Even if write times out, it may return n > 0, indicating that
// Even if write times out, it may return n > 0, indicating that
// some of the data was successfully written.
// some of the data was successfully written.
// A zero value for t means Write will not time out.
SetWriteDeadline
(
t
time
.
Time
)
error
SetWriteDeadline
(
t
time
.
Time
)
error
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment