Abstract. We propose a model for Stochastic Hybrid Systems (SHSs) where transitions between discrete modes are triggered by stochastic events much like transitions between states of a continuous-time Markov chains. However, the rate at which transitions occur is allowed to depend both on the continuous and the discrete states of the SHS. Based on results available for Piecewise-Deterministic Markov Process (PDPs), we provide a formula for the extended generator of the SHS, which can be used to compute expectations and the overall distribution of the state. As an application, we construct a stochastic model for on-off TCP flows that considers both the congestion-avoidance and slow-start modes and takes directly into account the distribution of the number of bytes transmitted. Using the tools derived for SHSs, we model the dynamics of the moments of the sending rate by an infinite system of ODEs, which can be truncated to obtain an approximate finite-dimensional model. This model shows that, for transfer-size distributions reported in the literature, the standard deviation of the sending rate is much larger than its average. Moreover, the later seems to vary little with the probability of packet drop. This has significant implications for the design of congestion control mechanisms.