本文整理汇总了C#中Target.ToEndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Target.ToEndPoint方法的具体用法?C# Target.ToEndPoint怎么用?C# Target.ToEndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Target
的用法示例。
在下文中一共展示了Target.ToEndPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToEndPointHostname
public void ToEndPointHostname()
{
var target = new Target ("localhost", 1234);
EndPoint endPoint = target.ToEndPoint();
Assert.That (endPoint, Is.InstanceOf<DnsEndPoint>());
DnsEndPoint dns = (DnsEndPoint) endPoint;
Assert.That (dns.Host, Is.EqualTo (target.Hostname));
Assert.That (dns.Port, Is.EqualTo (target.Port));
}
示例2: ToEndPointIPv4
public void ToEndPointIPv4()
{
var target = new Target ("127.0.0.1", 1234);
EndPoint endPoint = target.ToEndPoint();
Assert.That (endPoint, Is.InstanceOf<IPEndPoint>());
IPEndPoint ip = (IPEndPoint) endPoint;
Assert.That (ip.Address, Is.EqualTo (IPAddress.Parse ("127.0.0.1")));
Assert.That (ip.AddressFamily, Is.EqualTo (AddressFamily.InterNetwork));
}
示例3: OnConnectionlessTempestMessage
protected override void OnConnectionlessTempestMessage(TempestMessage tempestMessage, Target target)
{
ConnectMessage connect = tempestMessage as ConnectMessage;
if (connect != null)
{
UdpServerConnection connection;
if (this.authKey != null)
connection = new UdpServerConnection (GetConnectionId(), target.ToEndPoint(), this, new RSACrypto(), this.crypto, this.authKey);
else
connection = new UdpServerConnection (GetConnectionId(), target.ToEndPoint(), this);
if (!this.connections.TryAdd (connection.ConnectionId, connection))
throw new InvalidOperationException ("Reused connection ID");
connection.Receive (connect);
}
else
base.OnConnectionlessTempestMessage (tempestMessage, target);
}