Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1397)

Delta Between Two Patch Sets: src/pkg/net/tcpsock.go

Issue 4244055: code review 4244055: net: drop laddr from Dial, cname from LookupHost; new f... (Closed)
Left Patch Set: diff -r 5ccb9b6f8cd1 https://go.googlecode.com/hg Created 13 years ago
Right Patch Set: diff -r 8b9c0b903333 https://go.googlecode.com/hg/ Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/net/sock.go ('k') | src/pkg/net/textproto/textproto.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // TCP sockets 5 // TCP sockets
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "os" 10 "os"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return os.EINVAL 206 return os.EINVAL
207 } 207 }
208 return setNoDelay(c.fd, noDelay) 208 return setNoDelay(c.fd, noDelay)
209 } 209 }
210 210
211 // File returns a copy of the underlying os.File, set to blocking mode. 211 // File returns a copy of the underlying os.File, set to blocking mode.
212 // It is the caller's responsibility to close f when finished. 212 // It is the caller's responsibility to close f when finished.
213 // Closing c does not affect f, and closing f does not affect c. 213 // Closing c does not affect f, and closing f does not affect c.
214 func (c *TCPConn) File() (f *os.File, err os.Error) { return c.fd.dup() } 214 func (c *TCPConn) File() (f *os.File, err os.Error) { return c.fd.dup() }
215 215
216 // DialTCP is like Dial but can only connect to TCP networks 216 // DialTCP connects to the remote address raddr on the network net,
217 // and returns a TCPConn structure. 217 // which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
218 // as the local address for the connection.
218 func DialTCP(net string, laddr, raddr *TCPAddr) (c *TCPConn, err os.Error) { 219 func DialTCP(net string, laddr, raddr *TCPAddr) (c *TCPConn, err os.Error) {
219 if raddr == nil { 220 if raddr == nil {
220 return nil, &OpError{"dial", "tcp", nil, errMissingAddress} 221 return nil, &OpError{"dial", "tcp", nil, errMissingAddress}
221 } 222 }
222 fd, e := internetSocket(net, laddr.toAddr(), raddr.toAddr(), syscall.SOC K_STREAM, 0, "dial", sockaddrToTCP) 223 fd, e := internetSocket(net, laddr.toAddr(), raddr.toAddr(), syscall.SOC K_STREAM, 0, "dial", sockaddrToTCP)
223 if e != nil { 224 if e != nil {
224 return nil, e 225 return nil, e
225 } 226 }
226 return newTCPConn(fd), nil 227 return newTCPConn(fd), nil
227 } 228 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return l.fd.Close() 285 return l.fd.Close()
285 } 286 }
286 287
287 // Addr returns the listener's network address, a *TCPAddr. 288 // Addr returns the listener's network address, a *TCPAddr.
288 func (l *TCPListener) Addr() Addr { return l.fd.laddr } 289 func (l *TCPListener) Addr() Addr { return l.fd.laddr }
289 290
290 // File returns a copy of the underlying os.File, set to blocking mode. 291 // File returns a copy of the underlying os.File, set to blocking mode.
291 // It is the caller's responsibility to close f when finished. 292 // It is the caller's responsibility to close f when finished.
292 // Closing c does not affect f, and closing f does not affect c. 293 // Closing c does not affect f, and closing f does not affect c.
293 func (l *TCPListener) File() (f *os.File, err os.Error) { return l.fd.dup() } 294 func (l *TCPListener) File() (f *os.File, err os.Error) { return l.fd.dup() }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b