The new SSH2Session.OpenDirectTCPIPChannel is fantastic! I”ve got a couple of problems or questions or feature requests for it ;)
I’m having trouble sending binary data through it though. It seems to corrupt bytes that are larger than the normal visible ASCII range. It only does this when sending data, it can receive the data sent though the pipe just fine. If I try to send this, the bytes are in hex here: 4A 0E 00 80 6D 63 6D 64 04 00 70 69 6E 67 what I actually receive is this: 4A 0E 00 C3 84 6D 63 6D 64 04 00 70 69 6E 67 it seems to be turning the 80 into C3 84? The return from the SSHChannel.Write command actually includes the extra byte, so in that case it’s returning one more than the length of the bytes I passed to it. So whatever is happening it’s happening before the data is sent and not after the data is received on the remote machine. Is this a text encoding issue? I tried some various transforms on converting that string to other encodings or forcing it’s encoding to be defined wrong or something and I couldn’t get a byte of 80 to turn into anything else so I’m not sure. C3 84 is an Ä and a valid UTF8 glyph code, but x80 is decimal 128 and technically a euro sign in the more recent ascii tables or maybe a Ç if looking at older ascii tables. So I’m not sure if thats helpful or not. I’ve temporarily worked around that problem by base 64 encoding the packets for testing and then that works. At least for a while Sending data seems to work fine all the time, but receiving it is difficult. I have made a Thread class as in one of your examples that just loops reading from the Channel and if there is any data there then I read it in and handle it. I had hoped to be able to do an app.sleepCurrentThread call to slow down the loop, but once I call that no more data is received at all. i don’t know if the thread hangs or if the Channel refuses to read any more out after that or not. Letting the loop spin without something to throttle it uses up about a quarter of a whole CPU just spinning there doing nothing. I had thought to switch to a timer calling 2 or 3 times a second to try to read from it. Thats low enough latency for this idea. I can’t make that read anything at all. In a timer event a call to SSH2Channel.read( 10000) always returns nothing while the exact same code running in a thread does return data. So thats not a viable solution either. The ideal solution would be for you to do all that background work and provide me a regular data available event in a subclass of the SSH2Channel ;) But I’d be perfectly happy to poll in a thread if I could throttle it’s CPU usage down to something reasonable. I’d also be happy with a non-blocking call to waitSocket that yielded time to other threads, or however else you can make it work. Lastly the incoming connection dies on me after a fairly short time with a -41 or “out of bounds” error. Once I get that error I can no longer do any reading from it at all. The reads all return nothing, but the error codes do change to 0 when a packet was received, then I read and there is nothing returned, and then the errors go back to being the -37 meaning that there is no new data. After a while of operating in this state the -41 error becomes a -4 error which translates to “invalid mac address” which makes no sense at all since it’s currently connected. I can still send data up the pipe to the remote machine, but I cannot receive any data back from it. It will eventually fall into that error condition with me just sending a test “ping” command and getting a ping response from the test client. I’m not taxing it or sending a huge amount of data or anything. It’s also very possible I simply don’t know how to use it properly ;) In which case any further guidance or pointers to online resources would be welcome. Thanks for adding this, it’s really going to be useful! Thanks, James James Sentman http://www.PlanetaryGear.org http://MacHomeAutomation.com _______________________________________________ Mbsplugins_monkeybreadsoftware.info mailing list [email protected] https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
