TCPSocket.send is erroring

Hello, I seem to be experiencing a problem.

I am a python programmer who is trying ruby, and I am liking it so
far. I do need help on an issue I am having though.

I am creating a TCP socket and attempting to send data through it,
with the following code, which was taken almost verbatim from a
website:

require 'socket'
streamSock = TCPSocket::new("www.ibm.com", 80)
streamSock.send("Hello\n")

and I get this error:

ArgumentError: wrong number of arguments (1 for 2)

So I try passing it an integer, and I guess that the second argument
may be the length of what to send, so I put in 6, as in

streamSock.send("Hello\n", 6)

But then I get this error:

Errno::EOPNOTSUPP: The attempted operation is not supported for the
type of object referenced. - send(2)

I can't figure out what's wrong. Can anyone help me figure this out?

streamSock.send("Hello\n")
ArgumentError: wrong number of arguments (1 for 2)

http://rubydoc.ruby-forum.com/doc/ruby-1.9.1-p129/classes/BasicSocket.html#M002537

might be helpful.

I think what you want is "write" which writes an entire string
[basically blocks until the entire string is written].

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.