本文整理汇总了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;
}
}