[erlang-questions] ssh_connection.exec/4 response length limit

Tony Rogvall <>
Sat Jan 16 15:42:37 CET 2016


You must adjust the window:

Add
	ssh_connection:adjust_window(Conn,Channel,Sz)

> On 16 jan 2016, at 12:08, Rubén Caro <> wrote:
> 
> Hello,
> 
> When I run this:
> 
> -----------------------------
> ssh:start().
> {ok, Conn} = ssh:connect("myip", 22, [ {user,"myuser"} ], 5000).
> {ok, Channel} = ssh_connection:session_channel(Conn, 5000).
> 
> L = fun Loop(N) ->
>  receive
>    {ssh_cm,_,{_,_,_,Data}} ->

ssh_connection:adjust_window(Conn,Channel,byte_size(Data))

>      Loop(N + byte_size(Data))
>  after
>    5000 -> io:format("~p~n",[N])
>  end
> end.
> 
> ssh_connection:exec(Conn, Channel, "yes", 5000).
> 
> L(0).

This will loop for a very long time

/Tony

> -----------------------------
> 
> I get the magic number 65536. A 'flush().' only says 'ok'. So no more messages on my inbox.
> 
> This happens running any command that generates a long enough output, not only 'yes'. Anything like 'while true; do echo; done;' or 'cat longenough.txt' would hit a similar limit.
> 
> Why is that? Can I go past this limit?
> 
> Thanks.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160116/52ed189d/attachment.bin>


More information about the erlang-questions mailing list