Created
March 15, 2011 16:42
-
-
Save mgodave/871002 to your computer and use it in GitHub Desktop.
Infinite Sequence of packets from capture interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns netflow.packet | |
(:import jpcap.JpcapCaptor) | |
(:import jpcap.packet.Packet)) | |
(def captor (JpcapCaptor/openFile "mytrace.pcap")) | |
(defn packet-seq [captor] | |
(let [packet (.getPacket captor)] | |
(when-not (= (Packet/EOF) packet) | |
(lazy-seq (cons packet (packet-seq captor)))))) | |
(doseq [packet (packet-seq captor)] | |
(println packet)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment