-using System;
+using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.Threading;
Assert.AreEqual(ep, connection.EndPoint);
//UdpConnection fields
- Assert.AreEqual(new IPEndPoint(IPAddress.Loopback, 4296), connection.RemoteEndPoint);
+ Assert.AreEqual(new IPEndPoint(IPAddress.Loopback, 4296), connection.EndPoint);
Assert.AreEqual(1, connection.Statistics.DataBytesSent);
Assert.AreEqual(0, connection.Statistics.DataBytesReceived);
}
-using System;
+using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.Threading;
Assert.AreEqual(ep, connection.EndPoint);
//UdpConnection fields
- Assert.AreEqual(new IPEndPoint(IPAddress.Loopback, 4296), connection.RemoteEndPoint);
+ Assert.AreEqual(new IPEndPoint(IPAddress.Loopback, 4296), connection.EndPoint);
Assert.AreEqual(1, connection.Statistics.DataBytesSent);
Assert.AreEqual(0, connection.Statistics.DataBytesReceived);
}
-using System;
+using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.Threading;
Assert.AreEqual(ep, connection.EndPoint);
//UdpConnection fields
- Assert.AreEqual(new IPEndPoint(IPAddress.Loopback, 4296), connection.RemoteEndPoint);
+ Assert.AreEqual(new IPEndPoint(IPAddress.Loopback, 4296), connection.EndPoint);
Assert.AreEqual(1, connection.Statistics.DataBytesSent);
Assert.AreEqual(0, connection.Statistics.DataBytesReceived);
}
{
this.Listener = listener;
this.ConnectionId = connectionId;
- this.RemoteEndPoint = endPoint;
this.EndPoint = endPoint;
this.IPMode = IPMode;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
/// </summary>
public Func<HazelInternalErrors, MessageWriter> OnInternalDisconnect;
- /// <summary>
- /// The remote end point of this connection.
- /// </summary>
- /// <remarks>
- /// This is the end point of the other device given as an <see cref="System.Net.EndPoint"/> rather than a generic
- /// <see cref="ConnectionEndPoint"/> as the base <see cref="Connection"/> does.
- /// </remarks>
- public EndPoint RemoteEndPoint { get; protected set; }
-
public virtual float AveragePingMs { get; }
public long GetIP4Address()
{
if (IPMode == IPMode.IPv4)
{
- return ((IPEndPoint)this.RemoteEndPoint).Address.Address;
+ return this.EndPoint.Address.Address;
}
else
{
- var bytes = ((IPEndPoint)this.RemoteEndPoint).Address.GetAddressBytes();
+ var bytes = this.EndPoint.Address.GetAddressBytes();
return BitConverter.ToInt64(bytes, bytes.Length - 8);
}
}
-using System;
+using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
: base()
{
this.EndPoint = remoteEndPoint;
- this.RemoteEndPoint = remoteEndPoint;
this.IPMode = ipMode;
this.socket = CreateSocket(ipMode);
0,
length,
SocketFlags.None,
- RemoteEndPoint,
+ EndPoint,
HandleSendTo,
null);
}
0,
bytes.Length,
SocketFlags.None,
- RemoteEndPoint);
+ EndPoint);
}
catch { }
base.Dispose(disposing);
}
}
-}
\ No newline at end of file
+}
-using System;
+using System;
using System.Net;
namespace Hazel.Udp
: base()
{
this.Listener = listener;
- this.RemoteEndPoint = endPoint;
this.EndPoint = endPoint;
this.IPMode = IPMode;
/// <inheritdoc />
protected override void WriteBytesToConnection(byte[] bytes, int length)
{
- Listener.SendData(bytes, length, RemoteEndPoint);
+ Listener.SendData(bytes, length, EndPoint);
}
/// <inheritdoc />
try
{
- Listener.SendDataSync(bytes, bytes.Length, RemoteEndPoint);
+ Listener.SendDataSync(bytes, bytes.Length, EndPoint);
}
catch { }
protected override void Dispose(bool disposing)
{
- Listener.RemoveConnectionTo(RemoteEndPoint);
+ Listener.RemoveConnectionTo(EndPoint);
if (disposing)
{
: base()
{
this.EndPoint = remoteEndPoint;
- this.RemoteEndPoint = remoteEndPoint;
this.IPMode = ipMode;
this.socket = CreateSocket(ipMode);
0,
length,
SocketFlags.None,
- RemoteEndPoint,
+ EndPoint,
HandleSendTo,
null);
}
var msg = MessageReader.GetSized(ushort.MaxValue);
try
{
- var ep = this.RemoteEndPoint;
+ EndPoint ep = this.EndPoint;
socket.BeginReceiveFrom(msg.Buffer, 0, msg.Buffer.Length, SocketFlags.None, ref ep, ReadCallback, msg);
}
catch
try
{
- var ep = this.RemoteEndPoint;
+ EndPoint ep = this.EndPoint;
msg.Length = socket.EndReceiveFrom(result, ref ep);
}
catch (SocketException e)