using System;
using System.Collections;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Configuration;
using System.Runtime.Serialization.Formatters;
using Core.Mes.ServerFrameWork;

namespace Core.Mes.ServerManager
{

    public class RemotingGate
    {
        ServerConfigure _servConf = null;
        public RemotingGate(ServerConfigure _servCfg)
        {
            _servConf = _servCfg;
            StartServer();
        }

        public void StartServer()
        {
            //try
            {
                IDictionary props = new Hashtable();
                props["port"] = _servConf.ServerPort;
                RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
                ChannelServices.RegisterChannel(new TcpChannel(Convert.ToInt32(props["port"])), false);

            }
            /*catch (Exception ex)
            {
                throw new  Exception(ex.Message, ex);
            }*/
        }

    }
}

