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ã
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ã
Sysop: | Karloch |
---|---|
Location: | Madrid, Spain |
Users: | 54 |
Nodes: | 8 (0 / 8) |
Uptime: | 128:58:00 |
Calls: | 700 |
Files: | 17,895 |
D/L today: |
128 files (60,769K bytes) |
Messages: | 66,010 |