﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Collections;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace Courier.Core.Tcp
{
    public class TcpServer : IServer
    {
        private IList<IPort> ports = new List<IPort>();

        public IPort Bind(int port)
        {
            return Bind(port, new BinaryFormatter());
        }

        public IPort Bind(int portNumber, IFormatter formatter)
        {
            TcpPort port = new TcpPort(portNumber, formatter);
            port.Open();
            ports.Add(port);
            return port;
        }
    }
}
