Connect.c - netcat, but for socks
http://gigo.com/ftp/pub/src/connect.c
Not my code. But, I find it useful. It provides a generic transport over SOCKS or HTTPS proxies; I personally use it liberally for shuttling SSH over SOCKS (after initiating an RSA keyfob thingie protected SSH session into work). Once I close my master session, all the sessions using socks automatically disappear too.
A newer copy is at its source..http://zippo.taiyo.co.jp/~gotoh/ssh/connect.c