private void ListenActivity() { EndPoint remote = new IPEndPoint(IPAddress.Any, 0); for (;;) { byte[] message = new byte[BUF]; while (this.socket.Available == 0) { } int size = this.socket.ReceiveFrom(message, ref remote); if (size == 0) continue; Debug.Print("Received " + size + " bytes from " + ((IPEndPoint)remote).Address + " (" + ((IPEndPoint)remote).Port + ")"); string messageString = ""; for (int i = 0; i < size; ++i) { messageString += (int)message[i] + " "; } Debug.Print(messageString); OtpInputStream inStream = new OtpInputStream(message); OtpErlangObject msg = inStream.read_any(); Debug.Print(msg.ToString()); OtpErlangTuple t = new OtpErlangTuple(new OtpErlangObject[] { new OtpErlangAtom("ok"), msg }); OtpOutputStream outStream = new OtpOutputStream(t, false); byte[] answer = outStream.GetBuffer(); this.socket.SendTo(answer, remote); Debug.Print(t.ToString()); } }
/// <summary>Initializes a new instance of the <see cref="ErlangErrorRpcException"/> class.</summary> /// <param name="tuple">The tuple.</param> public ErlangErrorRpcException(OtpErlangTuple tuple) : base(tuple.ToString()) { this.reasonTuple = tuple; }