It's not that simple, u have to connect to the proxy host and not to the server.
Then u have to write (sockwrite) this to the socket:

SOCKS4: 1 4 1 [OCTET-STRUCTURE PORT] [IP] 0
Reply u get (feedback):
x 90 x (x can be anything)
> Socks4 is correct (working) + connecting

SOCKS5: 1 5 1 0
Reply u get (feedback):
5 0
Then u have to write (sockwrite):
1 5 1 0 1 [IP] [OCTET-STRUCTURE PORT]
Reply u get on last command (feedback):
5 0 0
> Socks5 is correct (working) + connecting

Some more info u need to have, the octet-structure of port 6667 is 26 11 and u need the server ip, so /dns irc.server.com and u have it, then u need to enter spaces where the dots are.
So 127.0.0.1 becomes 127 0 0 1.

I don't know how to connect with proxys. Some ppl uses other ways to connect (I thought), it's possible, but I forgot :P
Sorry for the messy post, but it's not that simple, you should look @ google for tutorials of socks4/socks5/proxy protocols.