I'm trying to create a winsock connection with a remote computer using
VB5 and api's. I can setup the winsock and create a socket but I can
seem to connect.
My problem is that I do not have a clue how to convert a server name
such as "ftp.microsoft.com" or "pop3.myprovider.co.uk" etc to a valid
long number for the sock_addr
I've used the GetHostByNameAlias function in the WskSock.bas file but
that returns a valid long number only if the hostname I give it is in
1.2.3.4 format. If I enter a hostname such as "pop3.mail.net" the
inet_addr( ) function, within the GetHostNameAlias( ) function,
returns a -1 so then the hostname is then passed to the gethostbyname(
) function and that returns a 0 wich in return give a INADDR_NONE
"pop3.mail.net" -->inet_addr ----> -1
"pop3.mail.net" -->gethostbyname----> 0
Somebody suggested that I use the gethostbyname( ) to resolve the
host name into an IP address, and then use inet_ntoa( ) to convert the
IP address into the format used by Winsock but the gethostname ( )
returns a 0.
I sure it is not as difficult as it seems to convert a Host name be it
a FTP server, mail server or even a HTTP.
I will be very greatful for any help.
Thankyou
Jamal Akhtar
jamal-...@usa.net