Cosmos/source2/Kernel/System/Cosmos.System/Network/IPv4/EndPoint.cs
sschocke_cp d8e888eac5 UDP Send and Receive now working.
Use new UdpClient(portNumber) to create a UDP client listening on that port, and UdpClient.Receive() to receive packets.
2012-03-21 12:03:04 +00:00

41 lines
1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.System.Network.IPv4
{
public class EndPoint : IComparable
{
internal Address address;
internal UInt16 port;
public EndPoint(Address addr, UInt16 port)
{
this.address = addr;
this.port = port;
}
public override string ToString()
{
return this.address.ToString() + ":" + this.port.ToString();
}
public int CompareTo(object obj)
{
if (obj is EndPoint)
{
EndPoint other = (EndPoint)obj;
if ((other.address.CompareTo(this.address) != 0) ||
(other.port != this.port))
{
return -1;
}
return 0;
}
else
throw new ArgumentException("obj is not a IPv4EndPoint", "obj");
}
}
}