1. A computer readable medium comprising computer readable program code embodied therein for causing a computer system to perform a method for optimizing a network stack, the method comprising: inputting network information into a transport protocol algorithm selector; inputting a first transport protocol algorithm into the transport protocol algorithm selector, wherein the transport protocol algorithm selector uses a Bayesian network, and wherein the Bayesian network comprises a plurality of nodes, wherein each of the nodes is one selected from a group consisting of the first transport protocol algorithm and one of a plurality of network conditions; analyzing a result of the transport protocol algorithm selector; selecting the first transport protocol algorithm based on the result; receiving a first packet in the network stack; and processing the first packet using the first transport protocol algorithm.