Just using sockets does not give you any security. The right choice depends on the application, the systems you use, and how users understand what they need to do to use it. For example, if you interact with the web server in a secure way, you are likely to end up using TLS / SSL for it. If you just transfer data between two systems, using ssh may very well be the most convenient way.
When you say "security", are you looking for encrypted data on the network? Authentication of communicating parties? Both?
TLS/SSL, , OpenSSL ( Perl ). , ssh, , , .
, FTP .