示例#1
0
文件: MainLib.cs 项目: nice1378/CGSF
        public Tuple<bool, string> InitAndStartNetwork(ServerNetworkConfig netConfig, ServerAppConfig appConfig)
        {
            AppConfig = appConfig;
            NetConfig = new NetworkConfig()
            {
                IP = netConfig.IP,
                Port = netConfig.Port,
                EngineDllName = netConfig.EngineDllName,
                MaxAcceptCount = netConfig.MaxAcceptCount,
                ThreadCount = netConfig.ThreadCount,
                ProtocolOption = 0,
                ProtocolID = 0,
                MaxBufferSize = netConfig.MaxBufferSize,
                MaxPacketSize = netConfig.MaxPacketSize,
            };

            var result = ServerNet.Init(NetConfig, null, null);
            if (result != NET_ERROR_CODE_N.SUCCESS)
            {
                return new Tuple<bool, string>(false,result.ToString());
            }

            if (ServerNet.Start(NetConfig.ProtocolID) == false)
            {
                return new Tuple<bool, string>(false, NET_ERROR_CODE_N.NETWORK_START_FAIL.ToString());
            }
            else
            {
                IsStartServerNetwork = true;
            }

            return new Tuple<bool, string>(true, NET_ERROR_CODE_N.SUCCESS.ToString());
        }
示例#2
0
 /// <summary>
 /// Set ConfigIP for NetworkDevice
 /// </summary>
 /// <param name="nic">Network device.</param>
 ///  /// <param name="config">IP Config</param>
 private static void SetConfigIP(NetworkDevice nic, IPConfig config)
 {
     NetworkConfig.Add(nic, config);
     AddressMap.Add(config.IPAddress.Hash, nic);
     MACMap.Add(nic.MACAddress.Hash, nic);
     IPConfig.Add(config);
     nic.DataReceived = HandlePacket;
 }
示例#3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config">Configuration</param>
 public ProtocolV2(NetworkConfig config)
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     _magic = config.Magic;
 }
示例#4
0
        public void TestGetClientOrg()
        {
            JObject jsonConfig = GetJsonConfig(1, 0, 0);

            NetworkConfig config = NetworkConfig.FromJsonObject(jsonConfig);

            Assert.AreEqual(CLIENT_ORG_NAME, config.GetClientOrganization().Name);
        }
示例#5
0
        public void Initialize()
        {
            var keystoreConfig = new KeystoreConfig();
            var networkConfig  = new NetworkConfig();
            var jsonRpcConfig  = new JsonRpcConfig();

            _configProvider = new JsonConfigProvider();
        }
示例#6
0
        public ConnectionListener(NetworkConfig config, IMessenger messenger)
        {
            _config      = config;
            _messenger   = messenger;
            _tcpListener = TcpListener.Create(_config.Port);

            ThreadPool.QueueUserWorkItem(AcceptNewClientThread);
        }
示例#7
0
 public static void Initialise(NetworkConfig config)
 {
     connectionListener = new ConnectionListener <T>(IPAddress.Parse(config.Host), config.Port);
     connectionListener.OnNewSession += (session) =>
     {
         pendingAdd.Enqueue(session);
     };
 }
示例#8
0
 public void SetUp()
 {
     _networkConfig   = new NetworkConfig();
     _discoveryConfig = new DiscoveryConfig();
     _statsManager    = Substitute.For <INodeStatsManager>();
     _peerStorage     = Substitute.For <INetworkStorage>();
     _loader          = new PeerLoader(_networkConfig, _discoveryConfig, _statsManager, _peerStorage, LimboLogs.Instance);
 }
示例#9
0
        public NetworkConfig GetNetworkConfig()
        {
            RovioResponse response = this.Request("/Cmd.cgi",
                new RequestItem("Cmd", "GetWlan.cgi"),
                new RequestItem("Cmd", "GetIP.cgi"),
                new RequestItem("Cmd", "GetMac.cgi"),
                new RequestItem("Cmd", "GetHttp.cgi"));
            NetworkConfig settings = new NetworkConfig();

            //------WLAN --
            settings.SSID = response["ESSID"];
            WifiMode mode;
            if (response["Mode"] == "Managed")
                mode = WifiMode.WirelessNetwork;
            else
                mode = WifiMode.Computer2ComputerNetwork;

            settings.Key = response["Key"];
            settings.Channel = int.Parse(response["Channel"]);

            //WepSet
            //WepAsc
            //WepGroup
            //Wep64type
            //Wep128type
            //CurrentWiFiState = OK

            //------ IP --
            //CameraName

            settings.Mode = mode;
            //dhcp / manually
            settings.DHCPEnabled = (response["IPWay"] == "dhcp");
            settings.RovioIPAddress = response["IP"];
            settings.SubnetMask = response["Netmask"];
            settings.DefaultGateway = response["Gateway"];
            settings.DNS = response["DNS0"];
            //DNS1
            //DNS2
            //Enable = 1

            settings.CurrentIP = response["CurrentIP"];
            settings.CurrentNetmask = response["CurrentNetmask"];
            settings.CurrentGateway = response["CurrentGateway"];
            settings.CurrentDNS0 = response["CurrentDNS0"];
            //CurrentDNS1
            //CurrentDNS2
            //CurrentIPState = STATIC_IP_OK

            //------ MAC --
            settings.MACAddress = response["MAC"];

            //------ HTTP --
            settings.WebPort = int.Parse(response["Port0"]);
            //Port1

            return settings;
        }
示例#10
0
        public void TestLoadFromConfigNoOrganization()
        {
            // Should not be able to instantiate a new instance of "Channel" without specifying a valid client organization


            JObject jsonConfig = GetJsonConfig(0, 1, 0);

            NetworkConfig.FromJsonObject(jsonConfig);
        }
示例#11
0
    protected override NetworkConfig CreateNetworkConfig()
    {
        NetworkConfig config = base.CreateNetworkConfig();

        // Not bothering with secure for now
        config.SignalingUrl = uSignalingUrl;

        return(config);
    }
示例#12
0
        /// <summary>
        /// Called upon the RpcQueueTests being instantiated.
        /// This creates an instance of the NetworkManager to be used during unit tests.
        /// Currently, the best method to run unit tests is by starting in host mode as you can
        /// send messages to yourself (i.e. Host-Client to Host-Server and vice versa).
        /// As such, the default setting is to start in Host mode.
        /// </summary>
        /// <param name="managerMode">parameter to specify which mode you want to start the NetworkManager</param>
        /// <param name="networkConfig">parameter to specify custom NetworkConfig settings</param>
        /// <returns>true if it was instantiated or is already instantiate otherwise false means it failed to instantiate</returns>
        public static bool StartNetworkManager(out NetworkManager networkManager, NetworkManagerOperatingMode managerMode = NetworkManagerOperatingMode.Host, NetworkConfig networkConfig = null)
        {
            // If we are changing the current manager mode and the current manager mode is not "None", then stop the NetworkManager mode
            if (CurrentNetworkManagerMode != managerMode && CurrentNetworkManagerMode != NetworkManagerOperatingMode.None)
            {
                StopNetworkManagerMode();
            }

            if (NetworkManagerGameObject == null)
            {
                NetworkManagerGameObject = new GameObject(nameof(NetworkManager));
                NetworkManagerObject     = NetworkManagerGameObject.AddComponent <NetworkManager>();

                if (NetworkManagerObject == null)
                {
                    networkManager = null;
                    return(false);
                }

                Debug.Log($"{nameof(NetworkManager)} Instantiated.");

                var unetTransport = NetworkManagerGameObject.AddComponent <UNetTransport>();

                if (networkConfig == null)
                {
                    networkConfig = new NetworkConfig
                    {
                        EnableSceneManagement = false,
                        RegisteredScenes      = new List <string>()
                        {
                            SceneManager.GetActiveScene().name
                        }
                    };
                }
                else
                {
                    networkConfig.RegisteredScenes.Add(SceneManager.GetActiveScene().name);
                }

                NetworkManagerObject.NetworkConfig = networkConfig;

                unetTransport.ConnectAddress    = "127.0.0.1";
                unetTransport.ConnectPort       = 7777;
                unetTransport.ServerListenPort  = 7777;
                unetTransport.MessageBufferSize = 65535;
                unetTransport.MaxConnections    = 100;
                unetTransport.MessageSendMode   = UNetTransport.SendMode.Immediately;
                NetworkManagerObject.NetworkConfig.NetworkTransport = unetTransport;

                // Starts the network manager in the mode specified
                StartNetworkManagerMode(managerMode);
            }

            networkManager = NetworkManagerObject;

            return(true);
        }
示例#13
0
        /// <summary>
        /// Init process. Sets configuration and triggers the connection process
        /// </summary>
        /// <returns>
        /// Returns IEnumerator so unity treats it as a Coroutine
        /// </returns>
        private IEnumerator Start()
        {
            if (sAddress == null)
            {
                //to avoid the awkward moment of connecting two random users who test this package
                //we use a randomized addresses now to connect only the local test Apps  ;)
                sAddress = "OneToManyTest_" + Random.Range(0, 1000000);
            }


            if (UnityCallFactory.Instance == null)
            {
                Debug.LogError("No access to webrtc. ");
            }
            else
            {
                UnityCallFactory.Instance.RequestLogLevel(UnityCallFactory.LogLevel.Info);
                //Factory works. Prepare Peers
                NetworkConfig config = new NetworkConfig();
                config.IceServers.Add(new IceServer(mStunServer));
                config.SignalingUrl = mSignalingServer;
                mMediaNetwork       = UnityCallFactory.Instance.CreateMediaNetwork(config);

                //keep track of multiple local instances for testing.
                mIndex = sInstances;
                sInstances++;
                Debug.Log("Instance " + mIndex + " created.");


                if (uSender)
                {
                    //sender will broadcast audio and video
                    mMediaConfig.Audio = true;
                    mMediaConfig.Video = true;

                    Debug.Log("Accepting incoming connections on " + sAddress);
                    mMediaNetwork.Configure(mMediaConfig);
                    mMediaNetwork.StartServer(sAddress);
                }
                else
                {
                    //this one will just receive (but could also send if needed)
                    mMediaConfig.Audio = false;
                    mMediaConfig.Video = false;
                    mMediaNetwork.Configure(mMediaConfig);
                }
                //wait a while before trying to connect othe sender
                //so it has time to register at the signaling server
                yield return(new WaitForSeconds(5));

                if (uSender == false)
                {
                    Debug.Log("Tring to connect to " + sAddress);
                    mMediaNetwork.Connect(sAddress);
                }
            }
        }
        public void Initialize()
        {
            var keystoreConfig = new KeyStoreConfig();
            var networkConfig  = new NetworkConfig();
            var jsonRpcConfig  = new JsonRpcConfig();
            var statsConfig    = new StatsConfig();

            _configProvider = new JsonConfigProvider("SampleJsonConfig.cfg");
        }
示例#15
0
 public ProtocolV2(NetworkConfig config, IBinaryConverter serializer)
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
     _magic      = config.Magic;
 }
示例#16
0
    /// <summary>
    /// Creates the call object and uses the configure method to activate the
    /// video / audio support if the values are set to true.
    /// </summary>
    /// generating new frames after this call so the user can see himself before
    /// the call is connected.</param>
    public virtual void SetupCall()
    {
        Append("Setting up ...");

        //hacks to turn off certain connection types. If both set to true only
        //turn servers are used. This helps simulating a NAT that doesn't support
        //opening ports.
        //hack to turn off direct connections
        //Byn.Net.Native.AWebRtcPeer.sDebugIgnoreTypHost = true;
        //hack to turn off connections via stun servers
        //Byn.Net.Native.WebRtcDataPeer.sDebugIgnoreTypSrflx = true;

        NetworkConfig netConfig = CreateNetworkConfig();


        Debug.Log("Creating call using NetworkConfig:" + netConfig);
        //setup the server
        mCall = UnityCallFactory.Instance.Create(netConfig);
        if (mCall == null)
        {
            Append("Failed to create the call");
            return;
        }
        mCall.LocalFrameEvents = mLocalFrameEvents;
        string[] devices = UnityCallFactory.Instance.GetVideoDevices();
        if (devices == null || devices.Length == 0)
        {
            Debug.Log("no device found or no device information available");
        }
        else
        {
            foreach (string s in devices)
            {
                Debug.Log("device found: " + s);
            }
        }
        Append("Call created!");
        mCall.CallEvent += Call_CallEvent;

        //this happens in awake now to allow an ui or other external app
        //to change media config before calling SetupCall
        //mMediaConfig = CreateMediaConfig();

        //make a deep clone to avoid confusion if settings are changed
        //at runtime.
        mMediaConfigInUse = mMediaConfig.DeepClone();
        Debug.Log("Configure call using MediaConfig: " + mMediaConfigInUse);
        mCall.Configure(mMediaConfigInUse);
        mUi.SetGuiState(false);

        if (mBlockSleep)
        {
            //backup sleep timeout and set it to never sleep
            mSleepTimeoutBackup = Screen.sleepTimeout;
            Screen.sleepTimeout = SleepTimeout.NeverSleep;
        }
    }
示例#17
0
    private NetworkConfig CreateNetworkConfig(Account account)
    {
        NetworkConfig config = new NetworkConfig();

        config.IceServers.Add(new IceServer(account.server, account.user, account.password));
        config.IceServers.Add(new IceServer(account.server2));
        config.SignalingUrl = account.url;
        return(config);
    }
示例#18
0
    /// <summary>
    /// Creates the call object and uses the configure method to activate the
    /// video / audio support if the values are set to true.
    /// generating new frames after this call so the user can see himself before
    /// the call is connected.
    /// </summary>
    public virtual void SetupCall()
    {
        Append("Setting up ...");

        //hacks to turn off certain connection types. If both set to true only
        //turn servers are used. This helps simulating a NAT that doesn't support
        //opening ports.
        //hack to turn off direct connections
        //Byn.Net.Native.AWebRtcPeer.sDebugIgnoreTypHost = true;
        //hack to turn off connections via stun servers
        //Byn.Net.Native.WebRtcDataPeer.sDebugIgnoreTypSrflx = true;

        NetworkConfig netConfig = CreateNetworkConfig();


        Debug.Log("Creating call using NetworkConfig:" + netConfig);
        //setup the server
        mCall = UnityCallFactory.Instance.Create(netConfig);
        if (mCall == null)
        {
            Append("Failed to create the call");
            return;
        }

        mCall.LocalFrameEvents = mLocalFrameEvents;
        string[] devices = UnityCallFactory.Instance.GetVideoDevices();
        if (devices == null || devices.Length == 0)
        {
            Debug.Log("no device found or no device information available");
        }
        else
        {
            foreach (string s in devices)
            {
                Debug.Log("device found: " + s + " IsFrontFacing: " + UnityCallFactory.Instance.IsFrontFacing(s));
            }
        }
        Append("Call created!");
        mCall.CallEvent += Call_CallEvent;



        //make a deep clone to avoid confusion if settings are changed
        //at runtime.
        mMediaConfigInUse = mMediaConfig.DeepClone();

        //try to pick a good default video device if the user wants to send video but
        //didn't bother to pick a specific device
        if (mMediaConfigInUse.Video && string.IsNullOrEmpty(mMediaConfigInUse.VideoDeviceName))
        {
            mMediaConfigInUse.VideoDeviceName = UnityCallFactory.Instance.GetDefaultVideoDevice();
        }

        Debug.Log("Configure call using MediaConfig: " + mMediaConfigInUse);
        mCall.Configure(mMediaConfigInUse);
        mUi.SetGuiState(false);
    }
示例#19
0
            public async Task StopAsync()
            {
                var t = NetworkConfig.StopAsync();

                m_source.Cancel();

                await t;
                await m_server;
            }
示例#20
0
 internal Client(INetworkClient client, MatchConfig config) : base(client, config)
 {
     NetworkClient.OnRecievedState  += OnRecievedState;
     NetworkClient.OnRecievedInputs += OnRecievedInputs;
     InputContext   = new MatchInputContext(config);
     InputHistory   = new InputHistory <MatchInput>(new MatchInput(config));
     NetworkConfig  = Config.Get <NetworkConfig>();
     InputSendTimer = 0;
 }
示例#21
0
        /// <summary>
        /// Remove IPConfig
        /// </summary>
        /// <param name="nic">Network device.</param>
        public static void RemoveIPConfig(NetworkDevice nic)
        {
            IPConfig config = NetworkConfig.Get(nic);

            AddressMap.Remove(config.IPAddress.Hash);
            MACMap.Remove(nic.MACAddress.Hash);
            IPConfig.Remove(config);
            NetworkConfig.Remove(nic);
        }
示例#22
0
        partial void DeployAction(NSObject sender)
        {
            var productId = Convert.ToByte(Globals.DeviceTypes.SingleOrDefault(x => x.Name == DeviceType.SelectedItem.Title).ProductID);

            FirmwareManager manager = new FirmwareManager();

            manager.FirmwareUpdateProgress += (string status) =>
            {
                InvokeOnMainThread(() => { DeployButton.Title = "Deploying... " + status + "%"; });
            };

            Task.Run(() =>
            {
                if (string.IsNullOrEmpty(_configFile) || string.IsNullOrEmpty(_flashFile) || string.IsNullOrEmpty(_bootFile))
                {
                    return;
                }

                InvokeOnMainThread(() =>
                {
                    DeployButton.Enabled         = false;
                    UpdateFirmwareButton.Enabled = false;
                    NetworkUpdateButton.Enabled  = false;
                    OutputToConsole("Started deploy");
                });

                try
                {
                    manager.EraseAndUploadDevice(0, productId, _configFile, _flashFile, _bootFile);
                }
                catch (Exception e)
                {
                    InvokeOnMainThread(() => OutputToConsole("Firmware update failed:\n" + e));
                }
                finally
                {
                    InvokeOnMainThread(() =>
                    {
                        _networkConfig = new NetworkConfig();
                        LoadNetworkSettings(true);

                        DeployButton.Title   = "Deploy";
                        DeployButton.Enabled = true;

                        NetworkUpdateButton.Enabled  = true;
                        UpdateFirmwareButton.Enabled = true;

                        BootFile   = string.Empty;
                        ConfigFile = string.Empty;
                        FlashFile  = string.Empty;

                        OutputToConsole("Finished deploy");
                    });
                }
            });
        }
示例#23
0
        /// <summary>
        /// Creates a new ICall object.
        /// Only use this method to ensure that your software will keep working on other platforms supported in
        /// future versions of this library.
        /// </summary>
        /// <param name="config">Network configuration</param>
        /// <returns></returns>
        public ICall Create(NetworkConfig config = null)
        {
            ICall call = mFactory.Create(config);

            if (call == null)
            {
                Debug.LogError("Creation of call object failed. Platform not supported? Platform specific dll not included?");
            }
            return(call);
        }
 internal Server(INetworkServer server, MatchConfig config) : base(server, config)
 {
     NetworkServer.ReceivedInputs += OnRecievedInputs;
     NetworkServer.PlayerRemoved  += OnRemovePlayer;
     InputContext    = new MatchInputContext(config);
     InputHistory    = new InputHistory <MatchInput>(new MatchInput(config));
     NetworkConfig   = Config.Get <NetworkConfig>();
     ClientTimesteps = new Dictionary <int, uint>();
     StateSendTimer  = 0;
 }
示例#25
0
        public void TestLoadFromConfigFileYamlBasic()
        {
            string        f      = TestUtils.TestUtils.RelocateFilePathsYAML("fixture/sdkintegration/network_configs/network-config.yaml".Locate());
            NetworkConfig config = NetworkConfig.FromYamlFile(f);

            Assert.IsNotNull(config);
            List <string> channelNames = config.GetChannelNames();

            Assert.IsTrue(channelNames.Contains("foo"));
        }
示例#26
0
 public TcpPeerListener(
     NetworkConfig config,
     ITcpPeerFactory peerFactory,
     ILogger <TcpPeerListener> logger)
 {
     _peerFactory = peerFactory;
     _logger      = logger;
     _listener    = new TcpListener(IPAddress.Any, config.Port);
     _listener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
 }
示例#27
0
        public void SetOptions()
        {
            ConnectionConfig connectionConfig;
            {
                TcpConnectionConfig tcpConnectionConfig;
                {
                    var info = this.ConnectionOptions.Tcp;
                    var type = TcpConnectionType.None;
                    if (info.Ipv4IsEnabled)
                    {
                        type |= TcpConnectionType.Ipv4;
                    }
                    if (info.Ipv6IsEnabled)
                    {
                        type |= TcpConnectionType.Ipv6;
                    }

                    tcpConnectionConfig = new TcpConnectionConfig(type, info.Ipv4Port, info.Ipv6Port, info.ProxyUri);
                }

                I2pConnectionConfig i2PConnectionConfig;
                {
                    var info = this.ConnectionOptions.I2p;
                    i2PConnectionConfig = new I2pConnectionConfig(info.IsEnabled, info.SamBridgeUri);
                }

                CustomConnectionConfig customConnectionConfig;
                {
                    var info = this.ConnectionOptions.Custom;
                    customConnectionConfig = new CustomConnectionConfig(info.LocationUris, info.ConnectionFilters, info.ListenUris);
                }

                CatharsisConfig catharsisConfig;
                {
                    var catharsisIpv4Config = new CatharsisIpv4Config(null, null);

                    catharsisConfig = new CatharsisConfig(catharsisIpv4Config);
                }

                connectionConfig = new ConnectionConfig(tcpConnectionConfig, i2PConnectionConfig, customConnectionConfig, catharsisConfig);
            }

            NetworkConfig networkConfig;

            {
                var info = this.ConnectionOptions.Bandwidth;
                networkConfig = new NetworkConfig(info.ConnectionCountLimit, info.BandwidthLimit);
            }

            lock (_serviceManager.LockObject)
            {
                var oldConfig = _serviceManager.Config;
                _serviceManager.SetConfig(new ServiceConfig(new CoreConfig(networkConfig, oldConfig.Core.Download), connectionConfig, oldConfig.Message));
            }
        }
示例#28
0
 internal Server(INetworkServer server, MatchConfig config) : base(server, config)
 {
     NetworkServer.ReceivedInputs += OnRecievedInputs;
     InputContext    = new MatchInputContext(config);
     LatestInput     = new MatchInput[1];
     LatestInput[0]  = new MatchInput(config);
     InputHistory    = new InputHistory <MatchInput>(LatestInput[0]);
     NetworkConfig   = Config.Get <NetworkConfig>();
     ClientTimesteps = new Dictionary <uint, uint>();
     StateSendTimer  = 0;
 }
示例#29
0
    //	public static NetworkConfig conf_UDP;
    //init
    public void init()
    {
        // Use this for initialization
        NetConnection.MSG_haldlerPool = new System.Collections.Generic.Dictionary <ushort, Type> ()
        {
            { (ushort)NetCode.CreateSelf, typeof(Rsp_CreateSelf) },
            { (ushort)NetCode.CreateOthers, typeof(Rsp_CreateOthers) },
            { (ushort)NetCode.UDP_UpdateStatus, typeof(Rsp_UpdateStatus) },           //UDP
            { (ushort)NetCode.BeatHeart, typeof(Rsp_HeartBeating) },
            { (ushort)NetCode.LeaveOffOthers, typeof(Rsp_LeaveOffOthers) },

            { (ushort)NetCode.Move, typeof(Rsp_StateUpdateMove) },
            { (ushort)NetCode.TabSwitch, typeof(Rsp_StatusUpdateTabSwitch) },
            { (ushort)NetCode.Sprint, typeof(Rsp_StatusUpdateSprint) },
            { (ushort)NetCode.Jump, typeof(Rsp_StatusUpdateJump) },
            { (ushort)NetCode.ExitGame, typeof(Rsp_StatusUpdateExitGame) },
        };
        NetConnection_UDP.MSG_haldlerPool = NetConnection.MSG_haldlerPool;

        DebugTool.setDebug(true);
        DebugTool.LogYellow("直接跳过登陆环节,此项目暂未添加登陆");
        LoginInfo.LoginState    = true;
        LoginInfo.loginInfo [0] = 1;
        LoginInfo.loginInfo [1] = 1;
        if (conf == null)
        {
            conf = NetworkConfig.GetInstance();
            //		conf.ip = "192.168.78.226";
            conf.ip = "127.0.0.1";
            //		conf.ip = "172.20.6.11";
            //		conf.ip = "192.168.1.106";
            //		conf.ip = "172.30.58.7";
        }
        conf.port               = 42020;
        conf.write_timeout      = 2000;
        conf.receiv_buffer_size = 1024;
        conf.connect_timeout    = 2000;
        //===============================
        //		if (conf_UDP == null) {
        //			conf_UDP = NetworkConfig.GetInstance ();
        //			//		conf.ip = "192.168.78.226";
        //			conf_UDP.ip = "127.0.0.1";
        //			//		conf.ip = "172.20.6.11";
        //			//		conf.ip = "192.168.1.106";
        //			//		conf.ip = "172.30.58.7";
        //		}
        //		conf_UDP.port = 2020;
        //		conf_UDP.write_timeout = 2000;
        //		conf_UDP.receiv_buffer_size = 1024;
        //		conf_UDP.connect_timeout = 2000;

        //Array.Copy(;
        DebugTool.LogRed("init Net :" + conf.ip);
    }
示例#30
0
        public void Can_resolve_local_ip_with_override()
        {
            string         ipOverride    = "99.99.99.99";
            INetworkConfig networkConfig = new NetworkConfig();

            networkConfig.LocalIp = ipOverride;
            var ipResolver = new IPResolver(networkConfig, LimboLogs.Instance);
            var address    = ipResolver.LocalIp;

            Assert.AreEqual(IPAddress.Parse(ipOverride), address);
        }
示例#31
0
 internal static void Start()
 {
     Console.WriteLine(Resources.Server_Start_Start);
     DatabaseManager.Initialize();
     NetworkConfig.Initialize();
     ClientManager.Initialize();
     NpcShopParser.Initialize();
     ItemManager.Initialize();
     InitializeServersAndChannels();
     Console.WriteLine(Resources.Server_Start_Success);
 }
        public RenderingController(NetworkConfig aNetworkConfig, Type aRendererClass, int aByteIndex)
        {
            config = aNetworkConfig;

            rendererType = aRendererClass;

            listener = new KinectListener(aByteIndex);
            listener.Attach(this);

            renderers = new List <KinectRenderer>();
        }
示例#33
0
        private static List<NetworkConfig> GetMacNo()
        {
            List<NetworkConfig> list = new List<NetworkConfig>();
            string strMac = "";

            //
            //方法1
            //
            NetworkInterface[] fNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();

            foreach (NetworkInterface adapter in fNetworkInterfaces)
            {
                if (adapter.OperationalStatus.Equals(OperationalStatus.Up))
                {
                    strMac = "";
                    strMac = adapter.GetPhysicalAddress().ToString();
                    if (strMac.Length != 0)
                    {
                        NetworkConfig netConfig = new NetworkConfig();
                        netConfig.mac = strMac;
                        netConfig.name = adapter.Name;

                        IPInterfaceProperties fIPInterfaceProperties = adapter.GetIPProperties();
                        UnicastIPAddressInformationCollection UnicastIPAddressInformationCollection = fIPInterfaceProperties.UnicastAddresses;
                        foreach (UnicastIPAddressInformation UnicastIPAddressInformation in UnicastIPAddressInformationCollection)
                        {
                            if (UnicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork)
                                netConfig.ip = UnicastIPAddressInformation.Address.ToString();
                        }

                        list.Add(netConfig);
                    }
                }
            }

            return list;
        }
示例#34
0
        private void loadBranch()
        {
            string ipsetting;
            string gatesetting, masksetting,dnsServers,priWINS,secWINS,NIC;

            try
            {

                //get file to load for the branch selected in
            string branchloadpath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                string branchloadfilename = branchloadpath + "\\SetLocation\\" +itemName.Text + ".txt";

                string[] branchReadArray = File.ReadAllLines(branchloadfilename).ToArray();

                //set all of these in setup
                //string eagleip = "10.1.5.80";
                //string eaglemask = "255.255.0.0";
                // string eaglegate = "10.1.1.1";
                //string NIC=""; //working on this
                //string priWINS="10.1.2.81";
                //string secWINS = "10.1.2.82";
                // string dnsServers = "10.1.2.81,10.1.2.82,10.1.2.83,10.30.1.12";

                ipsetting = branchReadArray[0]; //ip address on setup form
                gatesetting = branchReadArray[1];//gateway on setup form
                masksetting = branchReadArray[2];//subnet mask on setup form
                dnsServers = branchReadArray[3];//dns on setupForm form
                priWINS = branchReadArray[4];//wins on setup form
                secWINS = branchReadArray[5];//wins 2 on setup form
                // = branchReadArray[6]  ;
                NIC = branchReadArray[7];

                NetworkConfig networkset = new NetworkConfig();
                networkset.SetIP(ipsetting, masksetting, gatesetting);
                networkset.SetWINS(NIC,priWINS,secWINS);

                networkset.SetNameservers(NIC, dnsServers);
                MessageBox.Show("Location is Set To "+ itemName.Text + cl);

            }
            catch (Exception er)
            {
                MessageBox.Show("There are no settings for this Branch Saved yet.. See I.T. Department");
               // MessageBox.Show(er.Message);

            }
        }
        public override void ExecuteCmdlet()
        {
            try
            {
                ProcessParameters();
                var netConfig = new NetworkConfig
                {
                    IsIscsiEnabled = EnableIscsi,
                    IsCloudEnabled = EnableCloud,
                    Controller0IPv4Address = controller0Address,
                    Controller1IPv4Address = controller1Address,
                    IPv6Gateway = ipv6Gateway,
                    IPv4Gateway = ipv4Gateway,
                    IPv4Address = ipv4Address,
                    IPv6Prefix = IPv6Prefix,
                    IPv4Netmask = ipv4Netmask,
                    InterfaceAlias = interfaceAlias
                };

                WriteObject(netConfig);
                WriteVerbose(string.Format(Resources.NewNetworkConfigCreated,InterfaceAlias.ToString()));
                return;
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }