Previous research on transport layer protocols for wireless sensor networks (WSNs) has focused on designing protocols specifically targeted for sensor networks. Most sensor networks applications, however, are only useful when connected to an external network. The deployment of TCP/IP in WSNs would enable direct connection between the WSN and external TCP/IP networks. However, TCP performs badly in wireless environments both in terms of throughput and energy efficiency. To overcome these problems in WSNs we have designed Distributed TCP Caching. This mechanism greatly enhances TCP performance by caching TCP segments on the nodes in the sensor network and locally retransmitting lost segments. Our simulations demonstrate that with these enhancements TCP performs well enough to be useful in wireless sensor networks.