DSIK_FILEZILLA/sikFtpClient/Connection/Connection.cs

40 lines
961 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace sikFtpClient.Connection
{
abstract class Connection
{
public int port { get; set; }
public string server { get; set; }
public TcpClient client { get; set; }
public static NetworkStream stream { get; set; }
protected string receiveData(NetworkStream stream)
{
Byte[] data = new byte[1024];
string responseData = string.Empty;
int bytes = stream.Read(data, 0, data.Length);
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
Console.WriteLine("Received: {0}", responseData);
return responseData;
}
protected void sendData(NetworkStream stream, Byte[] data)
{
stream.Write(data, 0, data.Length);
}
}
}