Board index » delphi » Telnet Unit

Telnet Unit

I'm trying to implement basic Multi-player support for my Tile-based RPG
game.  What I was thinking of doing was creating a telnet shell to run
on the server and simply using this shell to communicate with the
server.  Speed is not a major concern to me as it is a 2D tile game.

I'm looking for a Unit that implments simple telnet commands like:

TelnetConnect('server.domain', 23);
WritelnTelnet('String...');
WriteTelnet('String...');
ReadlnTelnet(variable);
TelnetDissconnect();

If you have any ideas please contact me.

BadQua...@toadmail.com

Thankyou, BQ.

 

Re:Telnet Unit


Quote
In article <3AE1C7CD.9070...@turtle.net>, Jon David Sawyer wrote:
> I'm trying to implement basic Multi-player support for my Tile-based RPG
> game.  What I was thinking of doing was creating a telnet shell to run
> on the server and simply using this shell to communicate with the
> server.  Speed is not a major concern to me as it is a 2D tile game.

Compiler/Target OS ?

Quote

> I'm looking for a Unit that implments simple telnet commands like:

> TelnetConnect('server.domain', 23);
> WritelnTelnet('String...');
> WriteTelnet('String...');
> ReadlnTelnet(variable);
> TelnetDissconnect();

This will be especially hard, ordinarily, TCP/IP doesn't wait. If something
arrives, it has to be handled directly.

So your program would have to be more or less event driven.

Quote
> If you have any ideas please contact me.

> BadQua...@toadmail.com

Not newsgroup policy.

Re:Telnet Unit


Target OS: Linux.
Compiler: Free Pascal Compiler 1.0.4

About TCP/IP not waiting:

Can't Linux run multi-threaded programs?  Why not create a thread
constantly listening for new information and then saving it.

Re:Telnet Unit


Quote
In article <3AE1DC51.7010...@turtle.net>, Jon David Sawyer wrote:

> Target OS: Linux.
> Compiler: Free Pascal Compiler 1.0.4

Now we are talking :-)

I myself are working in that direction too, except mainly on FreeBSD. (but
probably it will be Unix generic enough). I'm still studying sockets in
general though.

Quote
> About TCP/IP not waiting:

> Can't Linux run multi-threaded programs?  Why not create a thread
> constantly listening for new information and then saving it.

That is possible. But threading with FPC is still a bit problematic, because
the libs are not yet reentrant. OTOH, the receiving thread wouldn't nearly do
anything.

However, there are some sockets programs. Check the FCL/test directory in
the sources, the docs for the socket unit, and I'll also dig up a small mini
chat server I once made.

You could also try to ask in the main FPC maillist (Called FPC-pascal).
Maybe somebody else did somethign similar since the last time this question
was asked (about a fat half year ago)

Re:Telnet Unit


I wanted to use Telnet to simplify the development of a protocal.
If I have to learn Scoket programming then I'm not making it easy.

I've got a simple, 2D rpg that I have oriented around a console (like
Quake) and you can issue commands such as move forward and turn left.

That is why I thought it would be a simple matter to create a shell
to run via telnet on a special port on the server machine.  And the
client would simply echo any commands you gave to the server aswell
as the game.

{Updates Would be similar.}

So, what I'm asking is, can this be done?

Re:Telnet Unit


Quote
In article <3AE2EC98.3010...@turtle.net>, Jon David Sawyer wrote:
> I wanted to use Telnet to simplify the development of a protocal.
> If I have to learn Scoket programming then I'm not making it easy.

> I've got a simple, 2D rpg that I have oriented around a console (like
> Quake) and you can issue commands such as move forward and turn left.

Ok.

Quote
> That is why I thought it would be a simple matter to create a shell
> to run via telnet on a special port on the server machine.  And the
> client would simply echo any commands you gave to the server aswell
> as the game.

Yes, but you don't need telnet for that. Raw sockets are about enough (with
a normal telnet, not with the win9x telnet which is special in some ways).

The extra overhead for telnet is more or less negotiations about console
types and the way how stuff is send (character per character or in line
mode)

Quote
> {Updates Would be similar.}
> So, what I'm asking is, can this be done?

No problem with raw sockets. No problem with Telnet either, but it is still
unimplemented and needs more work.

I will dig up that chatserver tomorrow, and I might have some partially
translated telnet headers for you, which you could use if you wanted to
implkement a telnet unit.

Re:Telnet Unit


Jon David Sawyer <j...@turtle.net> wrote:

Quote
> That is why I thought it would be a simple matter to create a shell
> to run via telnet on a special port on the server machine.  And the
> client would simply echo any commands you gave to the server aswell
> as the game.
> So, what I'm asking is, can this be done?

Sure.  However, setting that sort of thing up doesn't have very much
to do with Pascal.  You go into /etc/inetd.conf, put an entry in for
the port that you want to listen in on and make sure to run telnetd on
it and use the "-L" option to have it run your program instead of
/bin/login.  ("man telnetd" or, in the case of my computer
"man in.telnetd" is your friend.)

You then read from wherever you expect keystrokes to come from and
write to wherever text output goes (C programmers, which I am one of
call it "stdin" and "stdout") and life is wonderful.  Keep an eye out
for HUP signals and EOF results on input and cleanup when they happen.

Other Threads