—Peer-to-Peer (P2P) systems gain much attention in recent years. According to many statistics, P2P systems contribute a significant portion of the Internet traffic. Individual Internet users that commonly employ P2P software to download electronic music, movies, software provide considerable income for Internet Service Providers (ISP). However, the use of P2P systems produces many problems related to traffic engineering, optimization, network congestion, etc. In this paper we propose a generic approach to offline modeling of flows in P2P systems. We focus exclusively on P2P file sharing systems. We show how various constraints following from real P2P systems can be formulated. The formulations can be applied for designing and optimization of P2P systems. To illustrate our approach we present results obtained from CPLEX solver.