Discussion:
Extract Domain Name and Port from FTP address
(too old to reply)
Jack Wright
2004-03-01 12:52:02 UTC
Permalink
Dear all,

I want to extract Domain Name and Port from FTP address, is there
any API available?
for eg. ftp://ftp.asptoday/downloads/supportfiles/articles023.zip

Thanks & Regards,
Jack
Pete Davis
2004-03-01 14:44:43 UTC
Permalink
Are you asking, given the string
ftp://ftp.asptoday/downloads/supportfiles/articles023.zip
how do you find the port and domain name?

Well, you'd have to parse the string. ftp.asptoday would be your domain,
though that doesn't appear to be a valid domain name.

The port is the default FTP port which is TCP port 21. If the port were
different, the string would be something like:

ftp://ftp.asptoday:551/downloads/supportfiles/articles023.zip

In this case, the 551 would be your port number (following the :)

So, again, you simply parse the string and see if there's a port number.

I believe there are APIs for breaking up a URL into its individual pieces,
but I can't think of it off the top of my head.

Pete
--
http://www.petedavis.net
Post by Jack Wright
Dear all,
I want to extract Domain Name and Port from FTP address, is there
any API available?
for eg. ftp://ftp.asptoday/downloads/supportfiles/articles023.zip
Thanks & Regards,
Jack
Continue reading on narkive:
Loading...