With a direction control valve you determine the direction of the flow and therefore the direction of operation of a hydraulic motor or cilinder. In the animation we use a so called 4/3-direction control valve ; the 4/3 comes from: 4 line connections and 3 positions.
The housing, commonly made of cast iron, with 4 line connections contains a spool of steel. This spool, which is kept in the centre of the housing by two springs, can shift in the housing. In the drawn position, the middle position, the P-port is closed so the pumpflow has to flow to the reservoir through the pressure relief valve. This generates a lot of heat and should be avoided if possible. The A- en B-port are closed as well so in this case a cylinder will be hydraulicly locked in its position. By shifting the spool to the left the cilinder will make its outward stroke. The oil flows from Port P to A to the cilinder and the oil from the rodside of the cilinder flows via port B to T back to the reservoir.