Folder structure reconstruction

This commit is contained in:
Fabian Stamm
2016-12-09 15:41:35 +01:00
parent df48102215
commit c4c32efb04
98 changed files with 5 additions and 2 deletions

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace MailServer.SMTPServer
{
public class SmtpPortListener
{
private static List<int> Ports { get; set; }
private int Port { get; set; }
private TcpListener Listener;
public SmtpPortListener(int port)
{
Port = port;
Logging.AddLogMessage(Logging.LoggingType.INFO, "Start TCP listener on port: " + Port);
Thread thread = new Thread(StartListeningAsync);
thread.Start();
}
public async void StartListeningAsync()
{
Listener = new TcpListener(IPAddress.Any, Port);
Listener.Start();
while (true)
{
var client = await Listener.AcceptTcpClientAsync();
var ip = (IPEndPoint)client.Client.RemoteEndPoint;
Logging.AddLogMessage(Logging.LoggingType.INFO, "New Client Logged in with ip: " + ip.Address.ToString() + "On port: " + Port + " to port: " + ip.Port);
new SmtpServerSession(client);
}
}
}
}