• Getting the telnet port number

    From Ree to All on Wednesday, January 19, 2011 10:14:09
    Hey, I'm working on a WebSocket to telnet re-director for Synchronet, and have a few questions:

    1) Is there a property/method I can use to determine what port the telnet server is running on? Currently I've hardcoded to connect to system.local_host_name on port 23, but ideally I'd like the port number to
    come from a variable like the host name does

    2) Will there be a problem with possibly having multiple connections from the same IP address? For example 5 different people could all be connecting via a WebSocket client, and so the WebSocket server will see 5 unique IP addresses, but then the Telnet server will see 5 connections from 127.0.0.1. If if's possible that some systems have a "only 1 connection per IP" rule in place, that'd be problematic, but I don't know if that's an option, or commonly enforced if it is.

    3) How do I get the service included in the official Synchronet release archives (hopefully enabled by default, but even if it's disabled but included that would be great too)? Or do I just distribute on my own site and hope people find it?

    Thanks,
    Rick
  • From echicken@ECBBS to Ree on Thursday, January 20, 2011 13:04:38
    Re: Getting the telnet port number
    By: Ree to All on Wed Jan 19 2011 10:14:09

    1) Is there a property/method I can use to determine what port the telnet server is running on? Currently I've hardcoded to connect to system.local_host_name on port 23, but ideally I'd like the port number to come from a variable like the host name does

    You could use the INI parsing functions to read that out of /sbbs/ctrl/sbbs.ini, like so:

    var f = new File(system.ctrl_dir + "sbbs.ini");
    f.open("r");
    var telnetPort = f.iniGetValue("BBS", "TelnetPort");
    f.close();

    (That's off the top of my head, syntax may differ slightly.)

    2) Will there be a problem with possibly having multiple connections from th same IP address? For example 5 different people could all be connecting via

    Not that I'm aware of - typically it's a matter of disallowing multiple logons from the same account rather than IP - but there could be such a setting somewhere. If so, not enabled by default afaik.

    3) How do I get the service included in the official Synchronet release archives (hopefully enabled by default, but even if it's disabled but includ that would be great too)? Or do I just distribute on my own site and hope people find it?

    Ask DM for a CVS account, or ask someone with a CVS account to post it for you.

    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230

    ---
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Digital Man to Ree on Thursday, January 20, 2011 18:53:01
    Re: Getting the telnet port number
    By: Ree to All on Wed Jan 19 2011 10:14 am

    Hey, I'm working on a WebSocket to telnet re-director for Synchronet, and have a few questions:

    1) Is there a property/method I can use to determine what port the telnet server is running on? Currently I've hardcoded to connect to system.local_host_name on port 23, but ideally I'd like the port number to come from a variable like the host name does

    Try server.socket.local_port.

    2) Will there be a problem with possibly having multiple connections from the same IP address? For example 5 different people could all be
    connecting via a WebSocket client, and so the WebSocket server will see 5 unique IP addresses, but then the Telnet server will see 5 connections from 127.0.0.1. If if's possible that some systems have a "only 1 connection
    per IP" rule in place, that'd be problematic, but I don't know if that's an option, or commonly enforced if it is.

    No, that should not be a problem.

    3) How do I get the service included in the official Synchronet release archives (hopefully enabled by default, but even if it's disabled but included that would be great too)? Or do I just distribute on my own site and hope people find it?

    You can send me the file(s) and I can commit them to CVS for you if you wish. If you think you might be performing continual improvements/updates, I can give you CVS access to commit changes yourself if you wish.

    digital man

    Snapple "Real Fact" #46:
    Elephants are the only mammal that cannot jump.
  • From Ree to echicken on Tuesday, January 25, 2011 05:08:25
    You could use the INI parsing functions to read that out of /sbbs/ctrl/sbbs.ini, like so:

    Didn't even think of doing it that way...worked perfect, thanks!
  • From Ree to Digital Man on Tuesday, January 25, 2011 05:40:08
    Try server.socket.local_port.

    server.socket is undefined for me. Is that a recent addition that isn't in
    the latest Win32 development build? (EXEs look to be from May)

    You can send me the file(s) and I can commit them to CVS for you if you wish. If you think you might be performing continual improvements/updates,
    I can give you CVS access to commit changes yourself if you wish.

    A CVS account would be great, as the WebSocket protocol is likely to change
    and then I won't have to repeatedly bug anyone.
  • From Digital Man to Ree on Tuesday, January 25, 2011 14:14:30
    Re: Re: Getting the telnet port number
    By: Ree to Digital Man on Tue Jan 25 2011 05:40 am

    Try server.socket.local_port.

    server.socket is undefined for me. Is that a recent addition that isn't in the latest Win32 development build? (EXEs look to be from May)


    It should be. In what context are you running (e.g. jsexec, service, web server, terminal server, etc.)?

    You can send me the file(s) and I can commit them to CVS for you if you wish. If you think you might be performing continual improvements/updates, I can give you CVS access to commit changes yourself if you wish.

    A CVS account would be great, as the WebSocket protocol is likely to change and then I won't have to repeatedly bug anyone.

    Email me the username and password you would like to use for CVS.

    digital man

    Snapple "Real Fact" #58:
    A sneeze travels out of your nose at 100mph.
  • From Ree to Digital Man on Wednesday, January 26, 2011 09:58:23
    Try server.socket.local_port.

    server.socket is undefined for me. Is that a recent addition that isn't in the latest Win32 development build? (EXEs look to be from May)


    It should be. In what context are you running (e.g. jsexec, service, web server, terminal server, etc.)?

    It's running as a service.

    Email me the username and password you would like to use for CVS.

    OK, I'll do that in a second.
  • From Digital Man to Ree on Wednesday, January 26, 2011 17:09:47
    Re: Re: Getting the telnet port number
    By: Ree to Digital Man on Wed Jan 26 2011 09:58 am

    Try server.socket.local_port.

    server.socket is undefined for me. Is that a recent addition that isn't in the latest Win32 development build? (EXEs look to be from May)


    It should be. In what context are you running (e.g. jsexec, service, web server, terminal server, etc.)?

    It's running as a service.

    That's wierd, server.socket should definitely be defined. What version of Synchronet are you using?

    digital man

    Snapple "Real Fact" #143:
    Q is the only letter in the alphabet not appearing in the name of any U.S. state.
  • From Ree to Digital Man on Wednesday, January 26, 2011 19:38:11
    That's wierd, server.socket should definitely be defined. What version of Synchronet are you using?

    The latest developer build EXEs for Windows, which are dated May 2010. Here's the results of a for (var prop in server) log(LOG_DEBUG, prop + "=" + server[prop]);

    1/26 10:24:43p 0632 WebSocket JavaScript service thread started
    1/26 10:24:43p 0632 WebSocket version=Synchronet Services 1.245
    1/26 10:24:43p 0632 WebSocket version_detail=Synchronet Services 1.245 Compiled May 14 2010 05:07:32 with MSC 1200
    1/26 10:24:43p 0632 WebSocket interface_ip_address=0.0.0.0
    1/26 10:24:43p 0632 WebSocket options=2048
    1/26 10:24:43p 0632 WebSocket clients=1

    which does match what I found in the documentation here: http://www.synchro.net/docs/jsobjs.html#server
  • From Digital Man to Ree on Thursday, January 27, 2011 14:23:44
    Re: Re: Getting the telnet port number
    By: Ree to Digital Man on Wed Jan 26 2011 07:38 pm

    That's wierd, server.socket should definitely be defined. What version
    of Synchronet are you using?

    The latest developer build EXEs for Windows, which are dated May 2010. Here's the results of a for (var prop in server) log(LOG_DEBUG, prop + "="
    + server[prop]);

    1/26 10:24:43p 0632 WebSocket JavaScript service thread started
    1/26 10:24:43p 0632 WebSocket version=Synchronet Services 1.245
    1/26 10:24:43p 0632 WebSocket version_detail=Synchronet Services 1.245 Compiled May 14 2010 05:07:32 with MSC 1200
    1/26 10:24:43p 0632 WebSocket interface_ip_address=0.0.0.0
    1/26 10:24:43p 0632 WebSocket options=2048
    1/26 10:24:43p 0632 WebSocket clients=1

    which does match what I found in the documentation here: http://www.synchro.net/docs/jsobjs.html#server

    Okay, server.socket is only defined for *static* services (e.g. ircd.js), so that checks out. The original question was how to discover the *Telnet* port, and server.socket.local_port would only do that if the script was running in the context of the Telnet server, so I think the point is moot and the sbbs.ini parsing is probably your best bet. I would use the file_cfgname() method to get the correct sbbs.ini filename derivation however, as there can be multiple sbbs*.ini files to choose from.

    digital man

    Snapple "Real Fact" #81:
    Alaska has more caribou then people.
  • From Ree to Digital Man on Friday, January 28, 2011 16:19:57
    Okay, server.socket is only defined for *static* services (e.g. ircd.js),
    so that checks out. The original question was how to discover the *Telnet* port, and server.socket.local_port would only do that if the script was running in the context of the Telnet server, so I think the point is moot and the sbbs.ini parsing is probably your best bet.

    OK, that makes sense. I see that's actually the method used in
    ftp-web-html.js (although to get the http port in that case).

    I would use the
    file_cfgname() method to get the correct sbbs.ini filename derivation however, as there can be multiple sbbs*.ini files to choose from.

    OK, I've updated the script accordingly (using ftp-web-html.js as a
    reference), thanks for the heads up on that.

    Rick