doing a socket connection using ssh service

Trying to establish a socket connection using ssh service - but want to use different login name for ssh than what currently logged in as - if under shell know to use ssh -l <login-name> host - however - not sure how to tell o.s. to use different login name when use connect command

What language are you writing in?

writing in unix-C