[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 回复:Is ssh appropriate for this use case?


On Friday, 10 April 2020 09:57:37 CEST 刘元哲 wrote:
> Hello, Chris
> 
> 
> I'm also learning libssh this few days, and found your problem when I wake
> up at afternoon :-).
 First of all, I think libssh tcp/ip forwarding can
> solve your problem, u need
> read https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-> port-forwarding-explained-with-examples.html(local port forwarding
> part) to understand what  does local port forwarding do and why
> it's an appropriate solution. Then u can read
> this https://api.libssh.org/stable/libssh_tutor_forwarding.html It
> shows the whole architecture about tcp/ip forward on client side. It holds
> one session between client(java) and server(c++), no matter how many
> simulation processes u have, it doesn't care. I'm not familiar with java,
> but libssh is used in C, maybe u need a JNI? Anyway once u can run this
> function, the server side(sshd_tcpip_forward.c), should be able to receive
> the request. Here to make things clear, libssh is not something u can use
> automatic, it's NOT openssh, a prebuilt binary with many options u can
> choose, u need to program some codes:
> the client side in tutor only show how to open a request to server, I think
> u need to make java part connect to some localhost port, see 4321,
 then in
> client code, u program a event_loop, check
> here:https://api.libssh.org/stable/group__libssh__poll.html,
> ssh_add_event_fd, use socket to listen at 4321, once something arrive,
> forward it to server. Obviously u need to define what the date struct, as u
> may have many simulation processes, and how long it
> is.(read ssh_channel_open_forward CAREFULLY!!, u must understand what
> the parameter should be). Now it's ready to send it, once server receive
> it, it also need to re-direct to ur cpp listen port, here u also need
> program with socket, like client side, use ssh_event callback.

Well, if you implement the server and client side there is no need for port 
forwarding. You can just implement the client and server with libssh to secure 
the communication.

All you need is a channel which reads and writes on both sides.


An example is gnash (gnu flash) which has a client and server implementation 
this way.



Follow-Ups:
Re: 回复:Is ssh appropriate for this use case?Christopher Morley <chris@xxxxxxxxxxxxxxx>
References:
Is ssh appropriate for this use case?Christopher Morley <chris@xxxxxxxxxxxxxxx>
=?gb18030?b?u9i4tKO6SXMgc3NoIGFwcHJvcHJpYXRlIGZvciB0?==?gb18030?b?aGlzIHVzZSBjYXNlPw==?="=?gb18030?b?wfXUqtXc?=" <945695107@xxxxxx>
Archive administrator: postmaster@lists.cynapses.org