Skip to content

Commit

Permalink
Basic skeleton for waiting for packets to be fed in.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinematics committed Dec 25, 2012
1 parent 10979a8 commit 8ae2889
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ParserCore/Monitors/PacketReader/PacketReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ private PacketReader()
ManualResetEvent abortMonitorThread = new ManualResetEvent(false);
#endregion


#region Interface Control Methods and Properties

/// <summary>
Expand Down Expand Up @@ -157,7 +156,6 @@ internal void PolExited(object sender, EventArgs e)

#endregion


#region Monitor RAM
/// <summary>
/// This function is run as a thread to read ram and raise events when new
Expand Down Expand Up @@ -189,9 +187,20 @@ internal void Monitor()
pol.Process.Exited += new EventHandler(PolExited);
}

while (!abortMonitorThread.WaitOne(0))
// Wait for packets published from Windower.
using (var ctx = new ZMQ.Context(1))
{
// Monitor packets.
using (Socket subscriber = ctx.Socket(SocketType.SUB))
{
subscriber.Connect("tcp://localhost:43350");
subscriber.Subscribe(pol.Process.Id.ToString(), Encoding.Unicode);

while (!abortMonitorThread.WaitOne(0))
{
string address = subscriber.Recv(Encoding.Unicode);
string contents = subscriber.Recv(Encoding.Unicode);
}
}
}
}
#endregion
Expand Down

0 comments on commit 8ae2889

Please sign in to comment.