public void Start(String URLorIP, int txPort, int rxPort)
{
if (!connected)
{
try
{
txendpoint = new IPEndPoint(IPAddress.Parse(URLorIP), txPort);
}
catch (FormatException)
{
//not an ip address... try resolving through DNS
IPHostEntry entry = System.Net.Dns.GetHostEntry(URLorIP);
txendpoint = new IPEndPoint(entry.AddressList[0], txPort);
}
client = new UdpClient(rxPort);
client.Connect(txendpoint);
rxthread = new System.Threading.Thread(new ThreadStart(ReceiveThread));
connected = true;
rxthread.Start();
}
}