On a RH Linux machine (call it myhost), I have executed a command of this nature:ssh -N -l myuser -f -L 12345:localhost:12345 <IP of firewalled machine>and am trying to connect to that tunnel from a C code client (running on myhost) with a socket created like this:sockfd = socket(AF_INET, SOCK_STREAM, 0);with a connect() call that looks like this:status = connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));where serv_addr is the product of this:hostinfo = gethostbyname(nameofhost);memset((void *) &serv_addr, 0, sizeof(serv_addr));serv_addr.sin_family = AF_INET;memcpy((void *)&serv_addr.sin_addr.s_addr, (void *)hostinfo->h_addr, hostinfo->h_length);I can successfully do it and all goes well (i.e. a corresponding server program running on the firewalled machine communicates with the client running on myhost) if the client's call to gethostbyname() to get the needed struct hostent info uses localhost but not if it uses the actual name of the local machine that I am running the client on.  That is, the resultant IP is 127.0.0.1 instead of the actual IP of the local machine.  If I use the latter, I get ECONNREFUSED at the client end.  What am I doing wrong, and/or what can I do to overcome this?  Thanks in advance for any good suggestions.
Connect to local end of SSH tunnel w/ 127.0.0.1 vs actual machine IP?
ip;ssh tunneling;socket