mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
doc: Use ssh_channel_accept_forward() in documentation.
This commit is contained in:
@@ -145,7 +145,7 @@ or whatever use you have for it.
|
|||||||
@subsection libssh_reverse Doing reverse port forwarding with libssh
|
@subsection libssh_reverse Doing reverse port forwarding with libssh
|
||||||
|
|
||||||
To do reverse port forwarding, call ssh_forward_listen(),
|
To do reverse port forwarding, call ssh_forward_listen(),
|
||||||
then ssh_forward_accept().
|
then ssh_channel_accept_forward().
|
||||||
|
|
||||||
When you call ssh_forward_listen(), you can let the remote server
|
When you call ssh_forward_listen(), you can let the remote server
|
||||||
chose the non-priviledged port it should listen to. Otherwise, you can chose
|
chose the non-priviledged port it should listen to. Otherwise, you can chose
|
||||||
@@ -164,6 +164,7 @@ int web_server(ssh_session session)
|
|||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int nbytes, nwritten;
|
int nbytes, nwritten;
|
||||||
|
int port;
|
||||||
char *helloworld = ""
|
char *helloworld = ""
|
||||||
"HTTP/1.1 200 OK\n"
|
"HTTP/1.1 200 OK\n"
|
||||||
"Content-Type: text/html\n"
|
"Content-Type: text/html\n"
|
||||||
@@ -186,7 +187,7 @@ int web_server(ssh_session session)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel = ssh_forward_accept(session, 60000);
|
channel = ssh_channel_accept_forward(session, 60000, &port);
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error waiting for incoming connection: %s\n",
|
fprintf(stderr, "Error waiting for incoming connection: %s\n",
|
||||||
|
Reference in New Issue
Block a user