detectProtocol

fnProtocol detectProtocol(NetConnection conn) @safe pure nothrow

Detects the application-layer protocol for a network connection.

This function uses heuristic analysis based on port numbers to classify connections into common protocol types.

Parameters

connThe network connection to analyze.

Returns

Protocol enum value indicating the detected protocol.

Example:

auto conns = netConnections();
foreach (conn; conns) {
  auto proto = detectProtocol(conn);
  writeln("Protocol: ", proto);
}