Example #1
0
 public void Set(GetPortRangeOptions other)
 {
     if (other != null)
     {
         m_ApiVersion = P2PInterface.GetportrangeApiLatest;
     }
 }
Example #2
0
        /// <summary>
        /// Get the current chosen port and the amount of other ports to try above the chosen port if the chosen port is unavailable.
        /// </summary>
        /// <param name="options">Information about what version of the <see cref="GetPortRange" /> API is supported</param>
        /// <param name="outPort">The port that will be tried first</param>
        /// <param name="outNumAdditionalPortsToTry">The amount of ports to try above the value in OutPort, if OutPort is unavailable</param>
        /// <returns>
        /// <see cref="Result" />::<see cref="Result.Success" /> - if the input options were valid
        /// <see cref="Result" />::<see cref="Result.InvalidParameters" /> - if the input was invalid in some way
        /// </returns>
        public Result GetPortRange(GetPortRangeOptions options, out ushort outPort, out ushort outNumAdditionalPortsToTry)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <GetPortRangeOptionsInternal, GetPortRangeOptions>(ref optionsAddress, options);

            outPort = Helper.GetDefault <ushort>();

            outNumAdditionalPortsToTry = Helper.GetDefault <ushort>();

            var funcResult = EOS_P2P_GetPortRange(InnerHandle, optionsAddress, ref outPort, ref outNumAdditionalPortsToTry);

            Helper.TryMarshalDispose(ref optionsAddress);

            return(funcResult);
        }