Beispiel #1
0
        /// <summary>
        /// Send a packet
        /// </summary>
        /// <param name="handle">SNI handle</param>
        /// <param name="packet">SNI packet</param>
        /// <param name="sync">true if synchronous, false if asynchronous</param>
        /// <returns>SNI error status</returns>
        public uint WritePacket(SNIHandle handle, SNIPacket packet, bool sync)
        {
            SNIPacket clonedPacket = packet.Clone();
            uint      result;

            if (sync)
            {
                result = handle.Send(clonedPacket);
                clonedPacket.Dispose();
            }
            else
            {
                result = handle.SendAsync(clonedPacket, true);
            }

            return(result);
        }