Subj : Re: Obtain Socket object from within script
To : echicken
From : Mortifis
Date : Tue Aug 13 2019 12:56 pm
> 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