[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

address/port separator



Is there a convention used to separate an ipv6 address and port?

Specifically, I'm talking about when giving an address/port combination
to a program that makes a tcp connection. I'm converting a program
written for ipv4 to use ipv6 as well, and it can take arguments like
this:

hostname:http
hostname:80
1.2.3.4:80
1.2.3.4:http

or just a port name or number, using a default address. The code as
written uses a construction like strrchr(name, ':') to see whether the
given argument contains a hostname and a port; if it doesn't find a ':'
it assumes it's just a port name/number, no hostname.

So far I've left it that way, so it will work as before for ipv4
hostnames and ip adresses, but will only work with ipv6 if the host is
specified as a name, not a colon-delimited ipv6 address.

My intuition is that the Right Way to do this is to split them up into 2
arguments, so instead of something like "-r host:port" it would look
like "-r hostname -p port", but I wonder if others have seen any useful
convention for this situation. I believe mozilla accepts ipv6 addresses
enclosed in brackets, is this behavior common to other programs as well?

Any suggestions you have (or FMs to R) are appreciated.

good times,
Vineet

-- 
Currently seeking opportunities in the SF Bay Area
Please see http://www.doorstop.net/resume.shtml

Attachment: pgpXLvyxaJS_1.pgp
Description: PGP signature


Reply to: