Beispiel #1
0
        public Peer Connect(Address address, int channelLimit, uint data)
        {
            CheckCreated();
            CheckChannelLimit(channelLimit);

            var nativeAddress = new LENet.Address(address.IPv4Host, address.Port);

            try
            {
                var peer = new Peer(_host.Connect(nativeAddress, (uint)channelLimit));
                if (peer.NativeData == null)
                {
                    throw new ENetException(0, "Host connect call failed.");
                }
                return(peer);
            }
            catch (Exception)
            {
                throw new ENetException(0, "Host connect call failed.");
            }
        }