Edit AllPages

I am writing an instant message application ( something like icq ). It basically uses UDP to communicate with the server. Now I want to add the Socks5 support for it ( seems that socks4 does not support UDP ). But I have no ideas about what should I do to modify my codes to implement that. Any suggestion is greatly appreciated.