other_program_languages/c# 4

c# sftp 사용 ubuntu 로 file 전송

해당 프로그램은 Windows 10 위에서 실행되는 C# 으로 만들어진 sftp client 로, Ubnunt 에서 실행되는 sftp server 로 접속하여, Windows 에서 Ubuntu 로 file을 전송한다. using Renci.SshNet; using Renci.SshNet.Sftp; //IP, Port, ID, PW using (SftpClient client = new SftpClient("111.111.111.111", 22, "root", "root")) { client.KeepAliveInterval = TimeSpan.FromSeconds(60); client.ConnectionInfo.Timeout = TimeSpan.FromMinutes(180); client.Operation..

C# ping program

해당 프로그램은 Windows 10 위에서 실행되는 C# 으로 만들어진 프로그램에서 , 외부 OS에 ping 으로 보내, network 연결을 확인하는 프로그램 입니다. try { Ping ping = new Ping(); PingOptions options = new PingOptions(); options.DonFragment = true; string data = "Hello World!"; byte[] buffer = ASCIIEncoding.ASCII.GetBytes(data); int timeout = 120; PingReply reply = ping.Send(IPAddress.Parse("111.111.111.111"), timeout, buffer, options); if (reply.St..

c# telnet client program

해당 프로그램은 Windows 10 위에서 실행되는 C# 으로 만들어진 telnet client 로, Ubnunt 에서 실행되는 telnet server 로 접속하여, shell script 를 실행하고, 그 결과를 출력하는 작업을 진행한다. using System.Net; using System.Net.Sockets; //IP, Port (telnet default : 23) var ipepBottom = new IPEndPoint(IPAddress.Parse("111.111.111.111"), 23); using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { client.Con..

C# ssh client program

해당 프로그램은 Windows 10 위에서 실행되는 C# 으로 만들어진 ssh client 로, Ubnunt 에서 실행되는 ssh server 로 접속하여, shell script 를 실행하고, 그 결과를 출력하는 작업을 진행한다. using Renci.SshNet; //Renci.sshNet 을 사용한다. //방법 1 using (var sshClient = new SshClient("111.111.111.111.", "root", "root")) //IP, ID, PW { sshClient.Connect(); //비교적 간단한 linux command를 한번 실행시키고, 그 결과를 전부 //받아오기 위해서 사용할 수 있다. var tel = sshClient.RunCommand("ls -l"); st..