The online racing simulator
Telnet
(21 posts, started )
Telnet
What about telnet instead if the complicated Insim thing?
Imagine the possibilities... wow

You could control lfs, and servers of course, from nearly
anything....

Btw, maintenance of the server protocol is much more
easier then patching Insim packets to get some new
weird game option work with it.

tx
-chuck
You must have misunderstood what InSim is. It is the link between LFS and external programs.
One does not simply telnet in to LFS.
Then call it plaintext-bidirectional-line orientated-TCP-Connection instead, if the word "telnet" distracts you
You would still need to have something at the other end to to interpret the commands. You could probably make a telnet interface on top of InSim if you really wanted..
Quote from chucknorris :Btw, maintenance of the server protocol is much more
easier then patching Insim packets to get some new
weird game option work with it.

Again, you've misunderstood the aim of InSim. It's not designed for management, although that is one application you can produce with it. It's designed as a general purpose input and output.

I will point out that;
1. Not all insim applications have to understand every packet. If you have an application which crashes when it finds an unknown packet then it's badly written
2. You could build a telnet / rcon / etc. interface on top of InSim
3. You couldn't make a simple telnet interface as "simple" as InSim for general purposes (i.e. not for management)
4. Errr, I'm not understanding how maintaining the insim connection is any more significantly complicated than a telnet session (it's still streams of TCP data)
I never said that I want to change the "aim" of Insim. Is there an
official one you know and I dont? I think no.

Sending C structures over the net is just the laziest way for
C developers, but the most difficult for all other counterparts,
except for C of course. Changing the data format to something
more useable for others is surely the right way. Today, its
nearly impossible to connect via java to lfs. And i assume its
quite impossible for the most scripting languages.

Its not a coincidence that the most important internet protocols
are simple plaintext protocols. POP3, SMTP, HTTP, FTP, IRC
Have you ever heard of?
#8 - filur
Quote from chucknorris :Today, its nearly impossible to connect via java to lfs. And i assume its quite impossible for the most scripting languages.

Sorry, but this is simply not true. I believe there's an InSim library for Java (jInSim), and i'm having no issues at all working with InSim thru PHP and Ruby.
Well then, looks like something useable
First good new i ever read in here,lol.

Can you send me some php scripts?
Just as an example,


thanks in advance
email : pedder55655
gmx.net

-chuck
Quote from chucknorris :Its not a coincidence that the most important internet protocols
are simple plaintext protocols. POP3, SMTP, HTTP, FTP, IRC
Have you ever heard of?

I don't consider POP3 or InSim to be comparable. Perhaps you should go and read up on Roy Fielding's (as in one of the HTTP spec writers) and his work on Waka (a binary payload replacement designed for specific HTTP requests) and why he's proposing Waka (I'll be kind, the keyword is "efficiency").

Granted it maybe "lazy", but saying that InSim should be more like the protocols you've outlined because they exist and they're common is a bad argument. Does that mean I should be a racist if I live in an area predominately populated with racists? No. If you want to go down that road then the obvious counter argument is that there are a vast number of binary protocols

Now say you wanted to make InSim easier for people, then go ahead and produce an InSim-to-CRLF-delimited-protocol module. Perhaps it will be more popular and easier to use than InSim itself (one of my goals in "fiddling" with luaLFS), but it'll piss someone off no matter what you do with it because it won't be exactly what they want.

The problem with anything based on TCP is how connection is kept and established and how data is delimited. De-C-ifying data isn't so tricky

Edit: Sorry if I've come across angry, that's not my intention. I just think you're wrong (j/k)
Here's a relatively simple model for an InSim framework for PHP 5. This code only knows about 4 packets so it's far from being complete. Usage example at the bottom.


<?php 
php

    define
('ISP_ISI',        1);
    
define('ISP_VER',        2);
    
define('ISP_TINY',        3);
    
define('ISP_SMALL',        4);
    
    
define('ISP_MST',        13);
    
    
define('TINY_CLOSE',    2);
    
    interface 
SocketDriver {
        public function 
open($destination);
        public function 
send($data);
        public function 
receive();
    }
    
    class 
TCPDriver implements SocketDriver {
        protected 
$buffer;
        protected 
$socket;
        
        function 
open($dest) {
            if (
$this->socket stream_socket_client('tcp://'.$dest$errno$errstr5))
                
stream_set_blocking($this->socketFALSE);
            else
                throw new 
Exception('no dice');
        }
        
        function 
send($data) {
            
fwrite($this->socket$data);
        }
        
        function 
receive() {
            if (
$data fread($this->socket1024)) {
                
$this->buffer .= $data;
                
$packets = array();
                
                while (
1) {
                    if (
strlen($this->buffer) < 4)
                        break;
                    
                    
$size array_shift(unpack('C'substr($this->buffer01)));
                    
                    if (
strlen($this->buffer) >= $size) {
                        
$packet substr($this->buffer0$size);
                        
$packets[] = $packet;
                        
                        
$this->buffer substr($this->buffer$size);
                        
                    }
                    else break;
                }
                
                return 
$packets;
            }
            
            return 
FALSE;
        }
    }
    
    abstract class 
ISP_Pack {
        static 
$ISP_TINY = array('C''C''C''C');
        static 
$ISP_ISI = array('C''C''C''C''v''v''C''C''v''a16''a16');
        static 
$ISP_MST = array('C''C''C''C''a64');
    }
    
    abstract class 
ISP_Unpack {
        static 
$ISP_VER 'CSize/CType/CReqI/CZero/a8Version/a6Product/vInSimVer';
    }
    
    class 
IS_Packet {
        static 
$socketdriver;
        
        static function 
bindSocketDriver(SocketDriver $driver) {
            
self::$socketdriver $driver;
        }
        
        function 
__set($v$l) { throw new Exception('no such field'); }
        function 
__get($v) { throw new Exception('no such field'); }
        
        function 
pack() {
            
$stack = eval('return ISP_Pack::$'.get_class($this).';');
            
            foreach (
$this as $item)
                
$packed .= pack(array_shift($stack), $item);
            
            return 
$packed;
        }
        
        static function 
unpack($data) {
            
$type array_shift(unpack('C'substr($data11)));
            
            switch (
$type) {
                case 
ISP_TINY:
                case 
ISP_SMALL:
                    
$subtype array_shift(unpack('C'substr($data31)));
                    
# switch ($subtype) ..
                    
break;
                
                case 
ISP_VER:
                    
$packet = new ISP_VER;
                    break;
                
                default:
                    return 
FALSE;
            }
            
            
$data unpack(eval('return ISP_Unpack::$'.get_class($packet).';'), $data);
            
            foreach (
$data as $var => $value)
                
$packet->{$var} = $value;
            
            return 
$packet;
        }
        
        function 
send() {
            
self::$socketdriver->send($this->pack());
        }
    }
    
    class 
ISP_ISI extends IS_Packet {
        var 
$Size 44;
        var 
$Type ISP_ISI;
        var 
$ReqI;
        var 
$Zero;
        var 
$UDPPort;
        var 
$Flags;
        var 
$Sp0;
        var 
$Prefix;
        var 
$Interval;
        var 
$Admin;
        var 
$IName;
    }
    
    class 
ISP_TINY extends IS_Packet {
        var 
$Size 4;
        var 
$Type ISP_TINY;
        var 
$ReqI;
        var 
$SubT;
    }
    
    class 
ISP_VER extends IS_Packet {
        var 
$Size;
        var 
$Type;
        var 
$ReqI;
        var 
$Zero;
        var 
$Version;
        var 
$Product;
        var 
$InSimVer;
    }
    
    class 
ISP_MST extends IS_Packet {
        var 
$Size 68;
        var 
$Type ISP_MST;
        var 
$ReqI;
        var 
$Zero;
        var 
$Msg;
    }
    
    
$mySocket = new TCPDriver;
    
$mySocket->open('127.0.0.1:29999');
    
    
IS_Packet::BindSocketDriver($mySocket);
    
    
$ISI = new ISP_ISI;
    
$ISI->ReqI 1;
    
$ISI->Admin 'password';
    
$ISI->IName 'PHP 5';
    
    
$ISI->send();
    
    while (
1) {
        
        if (
$packets $mySocket->Receive()) {
            foreach (
$packets as $packet) {
                
$packet IS_Packet::unpack($packet);
                
                if (
$packet instanceof ISP_VER) {
                    echo 
'Connected to LFS '$packet->Product' '$packet->Version' / InSim v'$packet->InSimVerPHP_EOL;
                    
                    
$MST = new ISP_MST;
                    
$MST->Msg 'Hello, World!';
                    
                    
$MST->send();
                    
                    
sleep(1);
                    
                    
$InSimClose = new ISP_TINY;
                    
$InSimClose->SubT TINY_CLOSE;
                    
$InSimClose->send();
                    
                    exit();
                }
            }
        }
        
        
sleep(1);
    }
?>

orite, thanks for that code
Why don't we SSH to our servers as well and edit the server. I'm sure Franky will allow root access to his servers!
How about HTTP, FTP, Gopher, and bittorent connections to LFS?
Quote from wheel4hummer :How about HTTP, FTP, Gopher, and bittorent connections to LFS?

Run torrents off franky's servers, now that sounds good
What! no RDC access to frankys servers!?
Yeah he has that (RDC).

Incidentally, Gopher rocks. Well, in it's own way.
well now, the thread is dead, like so many before
got trolled to death.

however its on the list and its up to scawen
Quote from chucknorris :well now, the thread is dead, like so many before
got trolled to death.

however its on the list and its up to scawen

Next time do some research before making another sensless suggestion. You can connect to InSim using telnet if you want to.
Quote from wheel4hummer :Next time do some research before making another sensless suggestion. You can connect to InSim using telnet if you want to.

Who said I want to connect via telnet?

Telnet
(21 posts, started )
FGED GREDG RDFGDR GSFDG