[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Telnet Server in Ruby

Stefan Lang

8/1/2006 2:28:00 AM

Does anyone know of a Telnet Server written purely in Ruby? It doesn't
have to be fully featured. I just need a remote shell for control of an
application that I am working on. Telnet is the preferred method since
the users of the system are used to using Telnet for network application
control and allows simple scripting via a socket.

I thought about writing my own using GServer and IO.popen, but before
embark on that I wanted to avoid re-inventing the wheel.

Thanks in advance.

Dale Martenson


--
Posted with http://De.... Sign up and save your mailbox.

17 Answers

Bill Kelly

8/1/2006 5:12:00 AM

0

From: "Dale Martenson" <devlists-ruby-talk@devlists.com>
>
> Does anyone know of a Telnet Server written purely in Ruby? It doesn't
> have to be fully featured. I just need a remote shell for control of an
> application that I am working on. Telnet is the preferred method since
> the users of the system are used to using Telnet for network application
> control and allows simple scripting via a socket.
>
> I thought about writing my own using GServer and IO.popen, but before
> embark on that I wanted to avoid re-inventing the wheel.

Hi,

For what it's worth... I have some ANSI/VT100 telnet libraries that support
partitioning the display into horizontal scrolling regions, and some reasonably
full featured line-editing handling insert, delete, scrolling long lines, command
history, scrollback buffers with PgUp/PgDn, etc...

Part of this project:
http://rubyforge.org/cgi-bin/viewvc.cgi/dorkbuster/dbcore/?root=...

The relevant files would be:
ansi.rb
ansi-term.rb
term-keys.rb
windowed-term.rb
line-edit.rb

On the plus side, they have unit tests. And on the plus side, each module
is relatively loosely coupled... On the downside, the lowest level module,
buffered-io.rb, uses kind of a weird approach I developed back under
ruby 1.6.8 when nonblocking I/O wasn't well-supported on win32 ruby,
and so buffered-io was an experiment that technically works (it runs over
thirty servers now, for years with no problems); but it's more
complicated than it needs to be.

These days, instead of buffered-io, I'd have likely started with something
something like the EventMachine library JEGII mentioned in his reply
on this thread.

But anyway, that said, ansi-term only relies on a few methods of
the buffered-io object passed into it, mainly #send_nonblock,
#recv_nonblock, and #recv_ready? ... hmm, also #eof, #peeraddr,
#wait_recv_ready, #flush ... It might not be _too_ hard to adapt.

Well ... anyway, maybe the code might be of some use, even if
it could take some massaging to fit into a different I/O model.

The license for the source files mentioned here is LGPL preferably,
or Ruby's license if LGPL won't work for you.


Hope this helps,

Bill



Francis Cianfrocca

8/1/2006 12:01:00 PM

0

To both JEGII and Bill Kelly:

I'd really like to see a telnet server capability built into and shipped
with EM. Although there hasn't been a release lately (my fault, just
gotta do it), if you look into the SVN you'll see where things are
going. We've added thread-pools (for handling locally-blocking things
like database calls) and also a "Deferred" object that acts just like
the one in Twisted (you add arbitrary callbacks and errbacks to it). And
there is some structure in the source tree for adding specific
network-protocol handlers. That's where a telnet server would fit in.
Another possibility, possibly better, is to treat EM as a platform, and
then people can ship servers as separate packages, like RoR.

JEGII: may I use your code posted above to make a first attempt? I'll
come back to you with annoying questions if I have trouble, of course
;-).

Bill: ditto with your windowing libraries. EM is licensed under either
Ruby terms or LGPL so you would need to allow a relaxation of terms in
order for your stuff to be included. If that's not poss, then maybe it
could be an outboard library.

Thoughts from anyone?

--
Posted via http://www.ruby-....

James Gray

8/1/2006 1:34:00 PM

0

On Aug 1, 2006, at 7:01 AM, Francis Cianfrocca wrote:

> JEGII: may I use your code posted above to make a first attempt? I'll
> come back to you with annoying questions if I have trouble, of course
> ;-).

You can use whatever you like. Bill's stuff is much farther along
though!

James Edward Gray II

Stefan Lang

8/1/2006 3:13:00 PM

0

On Tuesday, August 01, 2006, at 2:11 PM, Bill Kelly wrote:
>From: "Dale Martenson" <devlists-ruby-talk@devlists.com>
>>
>> Does anyone know of a Telnet Server written purely in Ruby? It doesn't
>> have to be fully featured. I just need a remote shell for control of an
>> application that I am working on. Telnet is the preferred method since
>> the users of the system are used to using Telnet for network
>>application
>> control and allows simple scripting via a socket.
>>
>> I thought about writing my own using GServer and IO.popen, but before
>> embark on that I wanted to avoid re-inventing the wheel.
>
>Hi,
>
>For what it's worth... I have some ANSI/VT100 telnet libraries that support
>partitioning the display into horizontal scrolling regions, and some
>reasonably
>full featured line-editing handling insert, delete, scrolling long
>lines, command
>history, scrollback buffers with PgUp/PgDn, etc...

Fantastic. This is beyond my original intent, but since this is
available, I will look at utilizing what I can.

Thank you,
Dale Martenson
--
Posted with http://De.... Sign up and save your mailbox.

Bill Kelly

8/1/2006 10:17:00 PM

0

From: "Francis Cianfrocca" <garbagecat10@gmail.com>
>
> Bill: ditto with your windowing libraries. EM is licensed under either
> Ruby terms or LGPL so you would need to allow a relaxation of terms in
> order for your stuff to be included.

No problem!

As of now, consider them "Ruby or LGPL".

I'll make a pass through the source and add some sort of header at
the top of the files stating this.


Regards,

Bill



Francis Cianfrocca

8/1/2006 10:30:00 PM

0

Bill Kelly wrote:
> From: "Francis Cianfrocca" <garbagecat10@gmail.com>
>>
>> Bill: ditto with your windowing libraries. EM is licensed under either
>> Ruby terms or LGPL so you would need to allow a relaxation of terms in
>> order for your stuff to be included.
>
> No problem!
>
> As of now, consider them "Ruby or LGPL".
>
> I'll make a pass through the source and add some sort of header at
> the top of the files stating this.
>
>
> Regards,
>
> Bill

Thanks Bill. I took a look through your code and it's neat,
there's a lot of stuff there. When I get a moment I'll take a pass at
figuring out how to make it run under EM. Seems so far like I can get
away primarily with changes in ansi-term.rb for a start, then
windowed-term.rb later.

Can you give me a hello-world program that runs your code as a telnet
server, that can (for example) serve a remote login? I started figuring
it out from your test cases, but I figure you can rattle it off the top
of your head.

--
Posted via http://www.ruby-....

Bill Kelly

8/3/2006 3:35:00 AM

0

From: "Francis Cianfrocca" <garbagecat10@gmail.com>
>
> Can you give me a hello-world program that runs your code as a telnet
> server, that can (for example) serve a remote login? I started figuring
> it out from your test cases, but I figure you can rattle it off the top
> of your head.

I've added a windowed-term-example.rb to the project:

http://rubyforge.org/cgi-bin/viewvc.cgi/dorkbuster/dbcore/windowed-term-example.rb?root=dorkbuster&a...


It accepts clients, and partitions the client's window into three regions.
Lines of text can be entered into the bottom region, with line editing and
command history, and the data entered is echoed to all clients in the
middle region. PgUp/PgDn should scroll through that data in the middle
region as it accumulates. The top region gets a timestamp printed to it
every second or so.

NOTE: You'll need to put your telnet into character mode (mode ch)
before connecting. I know there must be a telnet escape sequence
I could send from the server to do that automatically, but, I didn't know
what it was.


Hope this helps,

Bill



Just Judy

8/31/2010 12:53:00 PM

0

On Tue, 31 Aug 2010 05:23:02 -0700, Mark <sac.easy.riders@gmail.com>
wrote:

>On 2010-08-31 04:11:55 -0700, Just Judy said:
>
>> On Mon, 30 Aug 2010 20:52:17 -0400, "JayMac" <macjay@optonline.net>
>> wrote:
>>
>>> http://www.merck.com/mmhe/resources/pronunciations/in...
>>>
>>> For those of you who wondered how to pronounce some medical words.
>>>
>>>
>>>
>>> John (JayMac)
>>
>> Thanks, John. I'm usually fairly good at guessing
>> pronunciations of medical terms, but there are many that leave my
>> tongue in knots. Pronouncing them correctly helps. *Your* website
>> solves my problem. ;)
>
>Back in the old day's i use to do the old fashion billing for Medi-Cal
>on a standard typewriter. Listing the charges was always a fun
>experience for anything more difficult then suture set.

Most of my work consists of transcribing telephone and
in-person conferences between the attorneys and the medical experts.
The med experts mumble, and the attorneys haven't a clue. Fortunately,
for me, the spellings are pretty predictable, but the pronunciations
can vary. The same is true of the names of medications, something else
I deal with almost daily.

I can't imagine trying to do billing based upon the
pronunciations of a doctor or nurse, and reading the notes of a doctor
or nurse, fergit it! Of course, they know how to pronounce the names,
but that doesn't include the layperson trying to understand.

I spent several days recently working on a sheaf of doctor's
notes. The lawyers were happy with my work, but that's only because
they were even more clueless than me. I can't imagine doing what I do
without the aid of the internet. It's been invaluable tool for me!
--
Judy~
http://www.frugalsites.net/911/s...

Mark

8/31/2010 1:52:00 PM

0

On 2010-08-31 05:52:43 -0700, Just Judy said:

> On Tue, 31 Aug 2010 05:23:02 -0700, Mark <sac.easy.riders@gmail.com>
> wrote:
>
>> On 2010-08-31 04:11:55 -0700, Just Judy said:
>>
>>> On Mon, 30 Aug 2010 20:52:17 -0400, "JayMac" <macjay@optonline.net>
>>> wrote:
>>>
>>>> http://www.merck.com/mmhe/resources/pronunciations/in...
>>>>
>>>> For those of you who wondered how to pronounce some medical words.
>>>>
>>>>
>>>>
>>>> John (JayMac)
>>>
>>> Thanks, John. I'm usually fairly good at guessing
>>> pronunciations of medical terms, but there are many that leave my
>>> tongue in knots. Pronouncing them correctly helps. *Your* website
>>> solves my problem. ;)
>>
>> Back in the old day's i use to do the old fashion billing for Medi-Cal
>> on a standard typewriter. Listing the charges was always a fun
>> experience for anything more difficult then suture set.
>
> Most of my work consists of transcribing telephone and
> in-person conferences between the attorneys and the medical experts.
> The med experts mumble, and the attorneys haven't a clue. Fortunately,
> for me, the spellings are pretty predictable, but the pronunciations
> can vary. The same is true of the names of medications, something else
> I deal with almost daily.
>
> I can't imagine trying to do billing based upon the
> pronunciations of a doctor or nurse, and reading the notes of a doctor
> or nurse, fergit it! Of course, they know how to pronounce the names,
> but that doesn't include the layperson trying to understand.
>
> I spent several days recently working on a sheaf of doctor's
> notes. The lawyers were happy with my work, but that's only because
> they were even more clueless than me. I can't imagine doing what I do
> without the aid of the internet. It's been invaluable tool for me!

Interesting.....I knew you did Attorney transcribing, but not medical.
Okay, another short one. I was also at a point in time what they
called at the time a Emergency Room Discharge Clerk. Among other
things, part of my job was to take the nightly charts and list out the
charges, procedures and diagnosis in an audit trailing book. That was
a lot of fun too!


--
Mark
Sacramento Easy Riders
Never ride faster than your guardian angel can fly. ~Author Unknown

"imagine me with my hands held over my head without a clue"
CG, Liar & Coward




WaIIy

8/31/2010 2:27:00 PM

0

On Tue, 31 Aug 2010 08:52:43 -0400, Just Judy
<JoodyJoodyJoody@gmail.com> wrote:

>On Tue, 31 Aug 2010 05:23:02 -0700, Mark <sac.easy.riders@gmail.com>
>wrote:
>
>>On 2010-08-31 04:11:55 -0700, Just Judy said:
>>
>>> On Mon, 30 Aug 2010 20:52:17 -0400, "JayMac" <macjay@optonline.net>
>>> wrote:
>>>
>>>> http://www.merck.com/mmhe/resources/pronunciations/in...
>>>>
>>>> For those of you who wondered how to pronounce some medical words.
>>>>
>>>>
>>>>
>>>> John (JayMac)
>>>
>>> Thanks, John. I'm usually fairly good at guessing
>>> pronunciations of medical terms, but there are many that leave my
>>> tongue in knots. Pronouncing them correctly helps. *Your* website
>>> solves my problem. ;)
>>
>>Back in the old day's i use to do the old fashion billing for Medi-Cal
>>on a standard typewriter. Listing the charges was always a fun
>>experience for anything more difficult then suture set.
>
> Most of my work consists of transcribing telephone and
>in-person conferences between the attorneys and the medical experts.
>The med experts mumble, and the attorneys haven't a clue. Fortunately,
>for me, the spellings are pretty predictable, but the pronunciations
>can vary. The same is true of the names of medications, something else
>I deal with almost daily.
>
> I can't imagine trying to do billing based upon the
>pronunciations of a doctor or nurse, and reading the notes of a doctor
>or nurse, fergit it! Of course, they know how to pronounce the names,
>but that doesn't include the layperson trying to understand.
>
> I spent several days recently working on a sheaf of doctor's
>notes. The lawyers were happy with my work, but that's only because
>they were even more clueless than me. I can't imagine doing what I do
>without the aid of the internet. It's been invaluable tool for me!

You may not be any good at math, but I'd bet you're a heck of a speller.