From: BCoish@... (Brad) Date: 2003-11-27T02:57:14+09:00 Subject: TCP/IP in Ruby All: I've run into a problem that I'm hoping is not unique. I am learning TCP/IP programming in Ruby and the following code generates a strange result: # CLIENT.RB # ========= require 'socket' s=TCPSocket.new("localhost", ARGV[0]) s.write("test\n") puts s.gets # 2nd read required to retrieve # modified string from server. # puts s.gets s.close # SERVER.RB # ========= require "socket" gs = TCPserver.open(0) printf("server is on port %d\n", gs.addr[1]) s=gs.accept puts s.gets s.write(s.gets.upcase) s.close The preceeding code is used to run a server that accepts a single client. The client sends the server a string, the server reads and converts the string to uppercase and then sends it back to the client. That's how it's supposed to work and on the PC it does work. However, on OpenVMS the client requires two, consecutive reads in order to get the uppercased value from the server (i.e. first read returns the original string "test"; second read returns the modified string sent back by the server "TEST"). This leads me to believe it's an internal buffer problem. Before I speculate further I wanted to ask if anyone has come across this before and what may be the cause of it. Regards, Brad BCoish@Dymaxion.com