What is the difference between session and flow in networks? In fact, I always visualize flow as a set of packets having the same source and destination. What confuses me is session. So I'd like to know the difference.
A flow is the data-plane stream of packets between sender and receiver that shares key IP header information. For example, a client at 10.1.1.1 port 12398 communicating with a server at 192.168.1.1 port 22 for SSH is a specific flow that can be captured as the key fields don't change.
A session is the control-plane communication between sender and receiver. The TCP 3-way handshake creates a session that establishes a connection between the sender's source port and receiver's destination listening port. TCP window size, initial sequence and acknowledge values, and keepalives are negotiated as part of building the session.
Basically, flow represents the data-plane and session represents the control-plane.
Edit: Removed bidirectional requirement for a flow.