Subj : Obtain Socket object from within script
To : Mortifis
From : echicken
Date : Tue Aug 13 2019 10:45 am
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.