Y
yuri.leikind
Hi all,
I am using Ruby to write a simple client program that write some bytes
to a tcp server and then reads bytes.
I have a working version in Java and Perl.
With the Ruby version I have extremely strange behavior - there are
redundant bytes.
It looks like where the Perl and Java client output is 0D 0A, my Ruby
client has 0D 0D 0A. (the server can send both binary and text data,
but it will mostly be used for binary data). The requests sent from all
clients are identical, I checked it many times.
In Perl bytes from the socket are read like this:
while($nr = read($maryDataSocket, $buf, 100000)) {
print STDOUT $buf
or die "Write error on stdout";
}
I do it like this:
while out = maryDataSocket.read(100000)
f.write(out)
end
And yes, before that I do
maryDataSocket.binmode()
bit that doesn't help.
What's wrong?
I use Ruby for Windows (have to :-( ) , version 1.8.2-15
There are some other really weird and frustrating things all related to
IO and \r and \n, but well, I just want to solve this problem. Hell, I
just want to read some bytes from the socket the way the are!
Thank you
Best regards,
Yuri Leikind
I am using Ruby to write a simple client program that write some bytes
to a tcp server and then reads bytes.
I have a working version in Java and Perl.
With the Ruby version I have extremely strange behavior - there are
redundant bytes.
It looks like where the Perl and Java client output is 0D 0A, my Ruby
client has 0D 0D 0A. (the server can send both binary and text data,
but it will mostly be used for binary data). The requests sent from all
clients are identical, I checked it many times.
In Perl bytes from the socket are read like this:
while($nr = read($maryDataSocket, $buf, 100000)) {
print STDOUT $buf
or die "Write error on stdout";
}
I do it like this:
while out = maryDataSocket.read(100000)
f.write(out)
end
And yes, before that I do
maryDataSocket.binmode()
bit that doesn't help.
What's wrong?
I use Ruby for Windows (have to :-( ) , version 1.8.2-15
There are some other really weird and frustrating things all related to
IO and \r and \n, but well, I just want to solve this problem. Hell, I
just want to read some bytes from the socket the way the are!
Thank you
Best regards,
Yuri Leikind