From: Hal Fulton Date: 2004-04-25T03:42:38+09:00 Subject: Re: Playing with sockets... Steven Jenkins wrote: > Hal Fulton wrote: > >> I'm writing a little expect-like piece of code and trying to test it >> by connecting to a telnet port. >> >> Not working at all for me. > > > I made the obvious changes to make it connect to the SMTP daemon on my > machine and it works fine on Linux with Ruby 1.8.1 (2004-02-06). > > Nothing is ever discarded from @data, and you search from the beginning > each time, so you'll never find the second occurence of any string, but > that's not the problem you're having here. That's a significant bug, thank you. > Are you sure your telnet daemon is behaving? That trash string found at > the beginning is not right. Apparently the server is trying to negotiate with the client. I tried to answer properly, to no avail. Then I tried to use Net::Telnet to do it and then pretend to be an ordinary socket. May work later, but not yet. Hmm. How hard would it be to write a little program (say, a tiny text adventure) to which I could connect via telnet? I've never written anything like a telnet server, but it doesn't seem hard if we skip the "real" functionality of it. Am I wrong? Thanks, Hal