Si Beaumont 4bd354e14a Update available to fix build for non-macOS Apple platforms (#1746) 2 năm trước cách đây
..
Empty.swift d3f5f64088 Update PCAP example to be async (#1422) 3 năm trước cách đây
PacketCapture.swift 4bd354e14a Update available to fix build for non-macOS Apple platforms (#1746) 2 năm trước cách đây
README.md d3f5f64088 Update PCAP example to be async (#1422) 3 năm trước cách đây

README.md

PCAP Debugging Example

This example demonstrates how to use the NIOWritePCAPHandler from NIOExtras with gRPC Swift.

The example configures a client to use the NIOWritePCAPHandler with a file sink so that all network traffic captured by the handler is written to a .pcap file. The client makes a single bidirectional streaming RPC to an Echo server provided by gRPC Swift.

The captured network traffic can be inspected by opening the .pcap with tools like Wireshark or tcpdump.

Running the Example

The example relies on the Echo server from a different example. To start the server run:

$ swift run Echo server

In a separate shell run:

$ swift run PacketCapture

The pcap file will be written to 'packet-capture-example.pcap'.

The .pcap file can be opened with either: Wireshark or tcpdump -r <PCAP_FILE>.