-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
I am using the OpenOfflineFile function to read libpcap data. I have tried these following functions:
os.Open()*TCPConn.File()os.Stdin
Only os.Stdin works fine. The others will throw Read Error after normally read few packages.
Here is the sample code about os.Open()
file, err = os.Open("/tmp/tmp.pcap")
handle, err := pcap.OpenOfflineFile(file)
source := gopacket.NewPacketSource(handle, handle.LinkType())
// Fetch packet
for {
packet, err := source.NextPacket()
// Will throw `Read Error`
if err != nil {
if err == io.EOF {
break
}
break
}
}Environment:
- macOS 10.14.6, Golang 1.14.1, libpcap 1.9.1
- Docker 19.03.5, Base image: debian: 10.3, Golang 1.14.2, libpcap 1.9.1
PS: OpenOffline works fine. But I want to read libpcap data through TCP connection.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels