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?
Re: Obtain Socket object from within script
By: Mortifis to All on Tue Aug 13 2019 10:29:37
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:
Why not just use client.socket?
var s = new Socket(SOCK_STREAM, user.protocol);
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.
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...
Sysop: | Kurt Hamm |
---|---|
Location: | Columbia, SC |
Users: | 8 |
Nodes: | 20 (0 / 20) |
Uptime: | 134:00:06 |
Calls: | 2,804 |
Calls today: | 1 |
Files: | 64 |
Messages: | 854,462 |