The proliferation of communication services that we depend on every day makes managing computer networks more important than ever. The increasing security, availability, and performance demands of these services suggest that these network-management problems must be solved in real time—and inside the network. In this new era, network management requires a fundamentally new approach. Instead of performing offline analysis of network traces, future networks should make real-time, closed-loop decisions—to block unwanted traffic, to reroute traffic to avoid congestion, and more. This talk explores how to bring together network measurement, analysis, and control, by leveraging recent advances in programmable network devices and the P4 programming language (www.p4.org). We present several example network “apps” that detect and fix performance and security problems, while still processing packets at line rate in high-speed switches with limited memory, and discuss our deployment experience using Intel Tofino switches in the Princeton campus network (https://p4campus.cs.