当前位置: 首页>>代码示例>>C#>>正文


C# UdpClient.Equals方法代码示例

本文整理汇总了C#中System.Net.Sockets.UdpClient.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# UdpClient.Equals方法的具体用法?C# UdpClient.Equals怎么用?C# UdpClient.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Sockets.UdpClient的用法示例。


在下文中一共展示了UdpClient.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: set_dtls_fd

        /// <summary>
        /// Set information needed to send and receive a DTLS connection
        /// </summary>
        /// <param name="ssl">structure to set information in</param>
        /// <param name="udp">UDP object to send and receive</param>
        /// <param name="ep">End point of connection</param>
        /// <returns>1 on success</returns>
        public static int set_dtls_fd(IntPtr ssl, UdpClient udp, IPEndPoint ep)
        {
            /* sanity check on inputs */
            if (ssl == IntPtr.Zero)
            {
                return FAILURE;
            }

            try
            {
                if (!udp.Equals(null) && !ep.Equals(null))
                {
                    IntPtr ptr;
                    DTLS_con con;
                    GCHandle gch = GCHandle.FromIntPtr(ssl);
                    ctx_handles handles = (ctx_handles)gch.Target;
                    GCHandle fd_pin;

                    con = new DTLS_con();
                    con.udp = udp;
                    con.ep = ep;
                    fd_pin = GCHandle.Alloc(con);
                    handles.set_fd(fd_pin);
                    ptr = GCHandle.ToIntPtr(fd_pin);
                    wolfSSL_SetIOWriteCtx(handles.get_ctx(), ptr); //pass along the socket for writing to
                    wolfSSL_SetIOReadCtx(handles.get_ctx(), ptr); //pass along the socket for reading from

                    return SUCCESS;
                }
                return FAILURE;
            }
            catch (Exception e)
            {
                log(ERROR_LOG, "Error setting up fd!! " + e.ToString());
                return FAILURE;
            }
        }
开发者ID:dgarske,项目名称:wolfssl,代码行数:44,代码来源:wolfSSL.cs


注:本文中的System.Net.Sockets.UdpClient.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。