My server-application listens to a local address 127.0.0.1:3000
I add TScSSHServer and set it to listen to an external address 192.168.1.1:40000
In the client-application I add TScSSHChannel and create a tunnel from the local address 127.0.0.1:20000 to connect to the server-application
(I may have given incomplete descriptions of the actions, but everything works)
How can I determine the actual address of the connected client on the server side in the server-application (get 192.168.1.2 instead of 127.0.0.1:20000)
How to obtain a valid IP-address?
i'll rephrase my question:
== server side ==
i have server application, that contains several threads.
First thread after start creates TScSSHServer object, configured to listen external IP address (192.168.1.1:33000)
Second thread listen incoming connections on local address (127.0.0.1:22000)
Second thread on accepting execute client threads, that do all work i need
== client side ==
On client side i create TScSSHClient and connect it from local address (10.10.10.5:25000) to server address (192.168.1.1:33000). Then I create channel to (127.0.0.1:22000).
Now i creating main client thread, that do all work through created channel.
My question is how to at server side in second thread (or produced client thread) get client address (10.10.10.5:25000).
== server side ==
i have server application, that contains several threads.
First thread after start creates TScSSHServer object, configured to listen external IP address (192.168.1.1:33000)
Second thread listen incoming connections on local address (127.0.0.1:22000)
Second thread on accepting execute client threads, that do all work i need
== client side ==
On client side i create TScSSHClient and connect it from local address (10.10.10.5:25000) to server address (192.168.1.1:33000). Then I create channel to (127.0.0.1:22000).
Now i creating main client thread, that do all work through created channel.
My question is how to at server side in second thread (or produced client thread) get client address (10.10.10.5:25000).
SSH protocol - Yes, but in my case all server threads owned by one process, so (in theory) I can get access to any TScSSHChannel and get its info. And only question is what criteria can i use to check is my connection transferred with selected channel or not.Dimon wrote:SSH protocol doesn't allow to get this client address on server side.
In my caseDimon wrote: You can do it on client side by processing the TScSSHChannel.OnSocketConnect event handler.
Code: Select all
MessageBox(0, inet_ntoa(SockAddr.sin_addr), '', 0);
If you use one process try to use the TScSSHChannel.OnSocketConnect and the TScSSHServer.BeforeChannelConnect event handlers interactively with mutex.Paroxizm wrote:SSH protocol - Yes, but in my case all server threads owned by one process, so (in theory) I can get access to any TScSSHChannel and get its info. And only question is what criteria can i use to check is my connection transferred with selected channel or not.
To solve this problem you should specify full computer name, but not "localhost" when you connect to TScSSHChannel tunnel. Also you should set the TScSSHChannel.GatewayPorts property to True.Paroxizm wrote:In my caseDimon wrote:You can do it on client side by processing the TScSSHChannel.OnSocketConnect event handler.returns '127.0.0.1'Code: Select all
MessageBox(0, inet_ntoa(SockAddr.sin_addr), '', 0);