|
Hello,
I want to write a c#-application which is able to transfer zipped files (tar.gz) to Linux-Server using SSH. A SH-Script on this server has to evaluate the data and then give the answer back to the windows client via stdOut.
The command line in the terminal in Linux to do this looks like this:
cat dummy.tar.gz | ssh root@192.168.13.7 /bin/remoteEvaluation.sh params
As I am understanding the tar-file first gets loaded into the StdOutput of the client and then it gets piped to be the StandardInput for the connection to the server via SSH. In Evaluation.sh the StandardInput gets evaluated and then the results gets back to the client via stdoutput of ssh.
I have just found a lib (SSH.Net) and was able to successfully connect to the server via ssh and to be able to execute some commands on this server:
PrivateKeyFile key = new PrivateKeyFile(@"D:\Path\id_rsa");
SshClient sshClient = new SshClient("192.168.13.7", "usr", new PrivateKeyFile[] { key });
sshClient.Connect();
SshCommand cmd = sshClient.CreateCommand("ls -ltr");
cmd.Execute();
Console.WriteLine(cmd.Result);
sshClient.Disconnect();
It's a pity that I don't know how to get zipped tar-file via stdIn into the server, so that the evaluation.sh has some input to evaluate.
I recognized that the SSH.Net-Lib also provides a function named "CreateShell", which looks like follows:
public Shell CreateShell(Stream input, Stream output, Stream extendedOutput, string terminalName, uint columns, uint rows, uint width, uint height, IDictionary<TerminalModes, uint> terminalModes, int bufferSize)
Furthermoe there is a function to create a Shellstream:
public ShellStream CreateShellStream(string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize)
Maybe I can use these functions to get the binary stream of the zipped file to the server.
If someone could give me a hint, how I can solve this problem I'd be very happy.
|
|
|
|
|
I Googled it and found this.[^]
It describes problem, but my table has a PK.
When I try to reference to table in code, it's not there.
Anyone know what's wrong?
If it's not broken, fix it until it is
|
|
|
|
|
Could be any one of a million things. Please try and be a bit more specific about what you are doing and what results you see.
Veni, vidi, abiit domum
|
|
|
|
|
There's nothing else to tell.
I drag a table from Server Explorer into the DBML Designer but it doesn't show in code.
If it's not broken, fix it until it is
|
|
|
|
|
|
Lo
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Any way the wind blows
Nothing really matters to me
|
|
|
|
|
to me.
Mama, just killed a man
Put a gun against his head
|
|
|
|
|
Pulled my trigger
Now he's dead
|
|
|
|
|
Mama, life had just begun
But now I've gone and thrown it all away
|
|
|
|
|
Mama. Ooo ooh oo oooooo
Didn't mean to make you cry.
|
|
|
|
|
If I'm not back again this time tomorrow
Carry on, carry on, as if nothing really matters
|
|
|
|
|
Look Here[^]
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
I got this piece of code from, I know not where, as a recommended way to write to a file.
using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
{
StreamWriter sw = new StreamWriter(fs);
sw.Write(textBox1.Text);
sw.Close();
}
Any thoughts?
|
|
|
|
|
electriac wrote: Any thoughts? My first thought is, "what is your question"?
Veni, vidi, abiit domum
|
|
|
|
|
Does this appear to be correct?
|
|
|
|
|
Appearances can be deceiving. Why not test it for yourself to see what happens, you may be surprised at what you can learn that way.
Veni, vidi, abiit domum
|
|
|
|
|
The term "correct" would be dependent upon the codes overall purpose. Since we know nothing of what you're doing or why, it's impossible to answer the question.
|
|
|
|
|
electriac wrote: Any thoughts? Not only the stream is disposable, but also the streamwriter.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Hi,
I've been playing around with multi-threaded code, setting affinity on different threads, etc... In my particular application, I have noticed performance is actually better when avoiding running threads concurrently on certain processors.
To be more precise, I have an hyper-threaded CPU and when assigning work to both logical processing units inside a core, it takes longer to run. Perhaps my code isn't optimized, but that's besides the point.
So my question is: How can I detect which two (or more, I'd like to be future proof here) logical processing units are from the same core?
I've done some research online and found some information that has lead me to believe CPU0 and CPU1 would be from the same core and CPU2 and CPU3 from the other one, in an hyper-threaded dual core CPU. But my testing is telling me otherwise (CPU0/CPU2 and CPU1/CPU3).
Thanks in advance!
Nic
|
|
|
|
|
Nicolas Légaré wrote: Perhaps my code isn't optimized, but that's besides the point. Show us the code. Parallel code is hard, and an inefficient implementation will always be slower. Task switching has it's overhead.
Nicolas Légaré wrote: I have noticed performance is actually better when avoiding running threads concurrently on certain processors. Windows uses threads a lot, so I'd expect it to be quite optimized. What processor are you seeing this on, do you have an example app that reproduces the problem?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy,
Thanks for replying.
I have since fixed up my code, it had issues with terminating threads. It's much faster now with both sides of the core running.
As an exercice though, how could I detect which logical processing units are part of one core? I was able to run a CPU stress test to test two CPUs at one, the results can tell me which two CPUs make up both sides of each core. This test takes a while to run, it'd be nice to have a simple API to call to get this.
Thanks
Nic
|
|
|
|
|
Hello everybody!
Im trying to do a Form Designer on C#, looked all over the web for this...Found an project using a custom dll, but i just want to know how to put the snaplines (that lines who helps a lot to align controls like in Visual Studio) on my form with my dinamically controls.. Someone could help me?
thanks!
Rafael
|
|
|
|
|
This is unclear, are you hosting the Windows Forms designer and you want to know how to show the snaplines?
Or...
Are you trying to design your forms runtime and you want to show snaplines?
Or...
Are you using custom controls in Visual Studio and you want your controls to participate in snaplines?
|
|
|
|