Пример #1
0
 private static void ListenSockets()
 {
     lock (global::SIPLib.Listener.LockListen)
     {
         global::System.Net.Sockets.UdpClient receivingUdpClient = new global::System.Net.Sockets.UdpClient(global::SIPLib.Listener.port);
         try
         {
             global::System.Net.IPEndPoint RemoteIpEndPoint = new global::System.Net.IPEndPoint(global::System.Net.IPAddress.Any, 0);
             while (true)
             {
                 byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);
                 global::SIPLib.Listener.WatchInfo(receiveBytes);
                 if (global::SIPLib.Listener.StopFlag == true)
                 {
                     break;
                 }
             }
         }
         catch
         {
             receivingUdpClient.Close();
             return;
         }
         receivingUdpClient.Close();
     }
 }
Пример #2
0
 public virtual object host()
 {
                 #line 117 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\net\\Socket.hx"
     global::System.Net.IPEndPoint localIP = ((global::System.Net.IPEndPoint)(this.sock.LocalEndPoint));
     global::sys.net.Host          tmp     = new global::sys.net.Host(((string)(localIP.Address.ToString())));
     {
                         #line 118 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\net\\Socket.hx"
         int __temp_odecl1 = localIP.Port;
                         #line 118 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\net\\Socket.hx"
         return(new global::haxe.lang.DynamicObject(new int[] { 1158860648 }, new object[] { tmp }, new int[] { 1247576961 }, new double[] { ((double)(__temp_odecl1)) }));
     }
 }
 internal static byte[] UdpTransfer(global::System.Net.IPEndPoint server, byte[] requestMessage)
 {
     object[] args = new object[] {
         server,
         requestMessage
     };
     byte[] ret = ((byte[])(m_privateType.InvokeStatic("UdpTransfer", new System.Type[] {
         typeof(global::System.Net.IPEndPoint),
         typeof(byte).MakeArrayType()
     }, args)));
     return(ret);
 }
Пример #4
0
 public virtual object peer()
 {
                 #line 112 "/opt/haxe/std/cs/_std/sys/net/Socket.hx"
     global::System.Net.IPEndPoint remoteIP = ((global::System.Net.IPEndPoint)(this.sock.RemoteEndPoint));
     global::sys.net.Host          tmp      = new global::sys.net.Host(((string)(remoteIP.Address.ToString())));
     {
                         #line 113 "/opt/haxe/std/cs/_std/sys/net/Socket.hx"
         int __temp_odecl1 = remoteIP.Port;
                         #line 113 "/opt/haxe/std/cs/_std/sys/net/Socket.hx"
         return(new global::haxe.lang.DynamicObject(new int[] { 1158860648 }, new object[] { tmp }, new int[] { 1247576961 }, new double[] { ((double)(__temp_odecl1)) }));
     }
 }
Пример #5
0
 private bool SendSocket(string ToIP, int port, byte[] sendBytes)
 {
     global::System.Net.IPAddress         ipAddress;
     global::System.Net.Sockets.UdpClient udpClient = new global::System.Net.Sockets.UdpClient();
     if (!System.Net.IPAddress.TryParse(ToIP, out ipAddress))
     {
         return(false);
     }
     ;
     global::System.Net.IPEndPoint ipEndPoint = new global::System.Net.IPEndPoint(ipAddress, port);
     try { udpClient.Send(sendBytes, sendBytes.Length, ipEndPoint); } catch { return(false); }
     return(true);
 }
Пример #6
0
 private bool SendSocket(string ToIP, int port, string Info)
 {
     global::System.Net.Sockets.UdpClient udpClient = new global::System.Net.Sockets.UdpClient();
     byte[] sendBytes = global::System.Text.Encoding.ASCII.GetBytes(Info);
     global::System.Net.IPAddress ipAddress = null;
     if (!System.Net.IPAddress.TryParse(ToIP, out ipAddress))
     {
         return(false);
     }
     ;
     global::System.Net.IPEndPoint ipEndPoint = new global::System.Net.IPEndPoint(ipAddress, port);
     try { udpClient.Send(sendBytes, sendBytes.Length, ipEndPoint); }
     catch { return(false); }
     return(true);
 }
Пример #7
0
 private void DataReceive()
 {
     lock (this.LockReceive)
     {
         global::System.Net.Sockets.UdpClient receivingUdpClient = new global::System.Net.Sockets.UdpClient(this._portReceive);
         global::System.Net.IPAddress         ipAddress;
         global::System.Net.IPAddress.TryParse(this._ToIP, out ipAddress);
         try
         {
             global::System.Net.IPEndPoint RemoteIpEndPoint = new global::System.Net.IPEndPoint(ipAddress, this._portReceive);
             while (true)
             {
                 byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);
                 this.DataArrived(receiveBytes, receiveBytes.Length);
             }
         } catch { /* NOTHING */ }
     }
 }