In this paper, we present a solution to the general problem of flow control for both unicast and multicast IP networks. We formulate a convex optimization problem that can be analytically solved with a low complexity. We show that with the proper choice of parameters, our problem can be fine-tuned to reward multicast flows or to provide maxmin fairness. Further, our formulation can be deployed in the form of a centralized, decentralized, or quasi-centralized flow control scheme. Using ECN marking to convey minimum per link or per zone flow information to the end nodes, our flow control schemes can be implemented with very little or no per flow state information.