public void ParseHostFromSocketTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string host = IPSocket.ParseHostFromSocket("localhost:5060"); Console.WriteLine("host=" + host); Assert.IsTrue(host == "localhost", "The host was not parsed correctly."); }
public void Test172IPRangeIsPrivate() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); Assert.IsFalse(IPSocket.IsPrivateAddress("172.15.1.1"), "Public IP address was mistakenly identified as private."); Assert.IsTrue(IPSocket.IsPrivateAddress("172.16.1.1"), "Private IP address was not correctly identified."); Console.WriteLine("-----------------------------------------"); }
public void ParsePortFromSocketTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); int port = IPSocket.ParsePortFromSocket("localhost:5060"); Console.WriteLine("port=" + port); Assert.IsTrue(port == 5060, "The port was not parsed correctly."); }
public void Send(IPEndPoint destinationEndPoint, byte[] buffer, int length) { try { if (destinationEndPoint == null) { throw new ApplicationException("An empty destination was specified to Send in SIPUDPChannel."); } else { if (m_udpClient != null && m_udpClient.Client != null) { m_udpClient.Send(buffer, length, destinationEndPoint); } } } catch (Exception excp) { logger.Error("Exception (" + excp.GetType().ToString() + ") UDPListener Send (sendto=>" + IPSocket.GetSocketString(destinationEndPoint) + "). " + excp.Message); throw excp; } }