• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload files to FTP server
#1
Bug 
Sending files to an FTP server, you can use your PC to send logs to a computer with the VPS.
PHP Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using Addon;

namespace 
FTP
{
    public class 
Class1 CPlugin
    
{
        public 
override void OnServerLoad()
        {
            var 
filename "plugins//log.txt";
            
string ftpServerIP "127.0.0.1";
            
string ftpUserID "admin";
            
string ftpPassword "12345";
            
string ftpPath "/public_html/";
            
FileInfo fileInf = new FileInfo(filename);
            
string uri "ftp://" ftpServerIP ftpPath fileInf.Name;
            
FtpWebRequest reqFTP;
            
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" ftpServerIP ftpPath fileInf.Name));
            
reqFTP.Credentials = new NetworkCredential(ftpUserIDftpPassword);
            
reqFTP.KeepAlive false;
            
reqFTP.Method WebRequestMethods.Ftp.UploadFile;
            
reqFTP.UseBinary true;
            
reqFTP.ContentLength fileInf.Length;
            
int buffLength 2048;
            
byte[] buff = new byte[buffLength];
            
int contentLen;
            
FileStream fs fileInf.OpenRead();
            try
            {
                
Stream strm reqFTP.GetRequestStream();
                
contentLen fs.Read(buff0buffLength);
                while (
contentLen != 0)
                {
                    
strm.Write(buff0contentLen);
                    
contentLen fs.Read(buff0buffLength);
                }
                
strm.Close();
                
fs.Close();
            }
            catch (
Exception ex)
            {
                
ServerPrint("[FTP Status]: " ex.Message);
            }
        }
    }

  Reply
#2
(01-27-2016, 20:17)S3VDIT0 Wrote: I think everyone realized Why is it necessary

I don't.
  Reply
#3
(01-28-2016, 09:03)SuperNovaAO Wrote:
(01-27-2016, 20:17)S3VDIT0 Wrote: I think everyone realized Why is it necessary

I don't.

Oh sorry =)
I'm in a hurry and could not explain.
This script I made of the need to send server logs to my FTP server, just when I am on the VPS I dig into folders server lag, as well as my PC quickly send logs or complaints about the players...
  Reply
#4
Зачем?
  Reply
#5
(01-28-2016, 16:50)zhorakrnev Wrote: Зачем?

Короче, серв на VPS хостинге, когда я роюсь в папках чтобы найти жалобы или логи сервера, тот ппц как лагает! А со сбросом через FTP на мой ПК(с запущенным FTP сервером) это не трабла, лагов нет я счастлив =)
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Release] MW3 Server Addon Extensions master131 211 30,028 04-15-2014, 01:35
Last Post: benjahwest

Forum Jump:


Users browsing this thread: 1 Guest(s)