Consistent class naming for TCPSocket...
From:
Sean Chittenden <sean@...>
Date:
2002-07-06 01:26:39 UTC
List:
ruby-core #213
Attached is a patch to fix consistency issues with TCPSocket and TCPsocket. I couldn't find an easy way to issue a warning if someone calls TCPsocket vs TCPSocket. Matz, do you plan on removing the constant for TCPsocket? One of the two attached patches is for ruby, the other for lib. -sc -- Sean Chittenden
Attachments (2)
patch
(3.9 KB, text/x-diff)
Index: lib/ping.rb
===================================================================
RCS file: /src/ruby/lib/ping.rb,v
retrieving revision 1.3
diff -u -r1.3 ping.rb
--- lib/ping.rb 2001/02/15 06:01:00 1.3
+++ lib/ping.rb 2002/07/06 01:06:53
@@ -44,7 +44,7 @@
def pingecho(host, timeout=5, service="echo")
begin
timeout(timeout) do
- s = TCPsocket.new(host, service)
+ s = TCPSocket.new(host, service)
s.close
end
rescue Errno::ECONNREFUSED
Index: lib/net/ftp.rb
===================================================================
RCS file: /src/ruby/lib/net/ftp.rb,v
retrieving revision 1.13
diff -u -r1.13 ftp.rb
--- lib/net/ftp.rb 2002/07/03 05:28:01 1.13
+++ lib/net/ftp.rb 2002/07/06 01:06:53
@@ -55,7 +55,7 @@
@passive = true
return SOCKSsocket.open(host, port)
else
- return TCPsocket.open(host, port)
+ return TCPSocket.open(host, port)
end
end
private :open_socket
@@ -173,7 +173,7 @@
private :sendport
def makeport
- sock = TCPserver.open(@sock.addr[3], 0)
+ sock = TCPServer.open(@sock.addr[3], 0)
port = sock.addr[1]
host = sock.addr[3]
resp = sendport(host, port)
Index: lib/net/protocol.rb
===================================================================
RCS file: /src/ruby/lib/net/protocol.rb,v
retrieving revision 1.62
diff -u -r1.62 protocol.rb
--- lib/net/protocol.rb 2002/03/26 11:18:02 1.62
+++ lib/net/protocol.rb 2002/07/06 01:06:53
@@ -395,7 +396,7 @@
def connect( otime )
D "opening connection to #{@address}..."
timeout( otime ) {
- @socket = TCPsocket.new( @address, @port )
+ @socket = TCPSocket.new( @address, @port )
}
@rbuf = ''
end
Index: lib/net/telnet.rb
===================================================================
RCS file: /src/ruby/lib/net/telnet.rb,v
retrieving revision 1.17
diff -u -r1.17 telnet.rb
--- lib/net/telnet.rb 2001/09/07 22:17:13 1.17
+++ lib/net/telnet.rb 2002/07/06 01:06:53
@@ -313,10 +313,10 @@
begin
if @options["Timeout"] == false
- @sock = TCPsocket.open(@options["Host"], @options["Port"])
+ @sock = TCPSocket.open(@options["Host"], @options["Port"])
else
timeout(@options["Timeout"]) do
- @sock = TCPsocket.open(@options["Host"], @options["Port"])
+ @sock = TCPSocket.open(@options["Host"], @options["Port"])
end
end
rescue TimeoutError
Index: sample/clnt.rb
===================================================================
RCS file: /src/ruby/sample/clnt.rb,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 clnt.rb
--- sample/clnt.rb 1998/01/16 12:13:08 1.1.1.1
+++ sample/clnt.rb 2002/07/06 01:06:53
@@ -6,7 +6,7 @@
host=(if ARGV.length == 2; ARGV.shift; else "localhost"; end)
print("Trying ", host, " ...")
STDOUT.flush
-s = TCPsocket.open(host, ARGV.shift)
+s = TCPSocket.open(host, ARGV.shift)
print(" done\n")
print("addr: ", s.addr.join(":"), "\n")
print("peer: ", s.peeraddr.join(":"), "\n")
Index: sample/dualstack-fetch.rb
===================================================================
RCS file: /src/ruby/sample/dualstack-fetch.rb,v
retrieving revision 1.2
diff -u -r1.2 dualstack-fetch.rb
--- sample/dualstack-fetch.rb 2001/05/26 03:38:39 1.2
+++ sample/dualstack-fetch.rb 2002/07/06 01:06:53
@@ -1,7 +1,7 @@
# simple webpage fetcher
# The code demonstrates how a multi-protocol client should be written.
-# TCPsocket is using getaddrinfo() internally, so there should be no problem.
+# TCPSocket is using getaddrinfo() internally, so there should be no problem.
require "socket"
@@ -36,7 +36,7 @@
#STDERR.print "path=<#{path}>\n"
STDERR.print "conntecting to #{host} port #{port}\n"
-c = TCPsocket.new(host, port)
+c = TCPSocket.new(host, port)
dest = Socket.getnameinfo(c.getpeername,
Socket::NI_NUMERICHOST|Socket::NI_NUMERICSERV)
STDERR.print "conntected to #{dest[0]} port #{dest[1]}\n"
lib-patch
(459 Bytes, text/x-diff)
Index: irc/irc/irc.rb
===================================================================
RCS file: /src/lib/irc/irc/irc.rb,v
retrieving revision 1.5
diff -u -r1.5 irc.rb
--- irc/irc/irc.rb 2001/01/31 10:55:28 1.5
+++ irc/irc/irc.rb 2002/07/06 01:06:43
@@ -205,7 +205,7 @@
else
@server = server
@port = port
- @socket = TCPsocket.open(@server, @port)
+ @socket = TCPSocket.open(@server, @port)
end
@socket.set_codesys("JIS")
end