• Obtain Socket object from within script

    From Mortifis@VERT/ALLEYCAT to All on Tue Aug 13 10:29:37 2019
    What is the best way to create a socket object on an already connected client?ããI have a sample door that already has user.* object access but I want to createãa new hot socket connection based on the current users client.socket;ãclient.port; client.protocol so that I can then:ããvar s = new Socket(SOCK_STREAM, user.protocol);ã then var real_ip = s.remote_ip_address; ... type thingieããIs this possible?ãããMy doctor said I have the body of a 25 year old ... and the mind of a 10 :-/ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From echicken@VERT/ECBBS to Mortifis on Tue Aug 13 10:45:41 2019
    Re: Obtain Socket object from within scriptã By: Mortifis to All on Tue Aug 13 2019 10:29:37ãã Mo> I have a sample door that already has user.* object access but I want toã Mo> create a new hot socket connection based on the current usersã Mo> client.socket; client.port; client.protocol so that I can then:ããWhy not just use client.socket?ãã Mo> var s = new Socket(SOCK_STREAM, user.protocol);ã Mo> then var real_ip = s.remote_ip_address; ... type thingieããThe value of client.socket.remote_ip_address is already available to you.ããApart from maybe reading this value, I have very rarely ever needed to interact directly with the clientãsocket in the context of a JS "door". IO with the client should really go through the existingãconsole/bbs methods unless there's a really good reason to bypass them.ããI suspect this isn't a path you need to go down.ãã Mo> Is this possible?ããI think you can do:ãã var s = new Socket(true, client.socket.descriptor);ããAs you can guess, I doubt if this is necessary in your case.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
  • From Mortifis@VERT/ALLEYCAT to echicken on Tue Aug 13 12:56:54 2019
    Re: Obtain Socket object from within scriptã > By: Mortifis to All on Tue Aug 13 2019 10:29:37ãã > Mo> I have a sample door that already has user.* object access but I wantã > Mo> to create a new hot socket connection based on the current usersã > Mo> client.socket; client.port; client.protocol so that I can then:ãã > Why not just use client.socket?ãã > Mo> var s = new Socket(SOCK_STREAM, user.protocol);ã > Mo> then var real_ip = s.remote_ip_address; ... type thingieãã > The value of client.socket.remote_ip_address is already available to you.ãã > Apart from maybe reading this value, I have very rarely ever needed toã > interact directly with the clientã > socket in the context of a JS "door". IO with the client should really goã > through the existingã > console/bbs methods unless there's a really good reason to bypass them.ãã > I suspect this isn't a path you need to go down.ãã > Mo> Is this possible?ãã > I think you can do:ãã > var s = new Socket(true, client.socket.descriptor);ãã > As you can guess, I doubt if this is necessary in your case.ããYou're right, not likely necessary. I had tried client.socket.remote_ip_addressãbut it was still showing as 127.0.0.1, so I suspect that connecting to anãalready open socket as var s = new Socket(true, client.socket.descriptor);ãprint(s.Socket.remote_ip_address) would likely just show what was alreadyãstored in client.socket.remote_ip_address; which is already user.ip_address andãbbs.atcode["CID] anyway ... hmmm...ããThanks, EC, I appreciate the responseããããããMy doctor said I have the body of a 25 year old ... and the mind of a 10 :-/ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From Mortifis@VERT/ALLEYCAT to echicken on Tue Aug 13 13:11:46 2019
    You're right, not likely necessary. I had triedã > client.socket.remote_ip_address but it was still showing as 127.0.0.1, so Iã > suspect that connecting to an already open socket as var s = newã > Socket(true, client.socket.descriptor); print(s.Socket.remote_ip_address)ã > would likely just show what was already stored inã > client.socket.remote_ip_address; which is already user.ip_address andã > bbs.atcode["CID] anyway ... hmmm...ããdespite the error in the print statement (should be s.remote_ip_address) theãassumption was correct ... that value is still 127.0.0.1 and not 24.138.28.115ã:-/ãããMy doctor said I have the body of a 25 year old ... and the mind of a 10 :-/ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã