public void Connect(IPAddress ip, Member member) { if (ip == null) { throw new ArgumentNullException(nameof(ip)); } AdapteeClient = new Socket(ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp); var endPoint = new IPEndPoint(ip, PcsServer.Port); AdapteeClient.Connect(endPoint); Console.WriteLine(Messages.Client.Connected, ip.MapToIPv4()); ftp = new PcsFtpClient(ip); SignIn(); void SignIn() { if (member == null) { throw new ArgumentNullException(nameof(member)); } SendPacket(new SignInPacket(member)); IsConnected = true; } }
public PcsServer(IPAddress serverAddress) { if (serverAddress == null) { throw new ArgumentNullException(nameof(serverAddress)); } listener = new PcsListener(serverAddress); ftpClient = new PcsFtpClient(serverAddress); connectedClients = new List <PcsClient>(); }