Marc-Andre Lemburg <m...@egenix.com> added the comment: Martin v. Löwis wrote: > > Martin v. Löwis <mar...@v.loewis.de> added the comment: > >> More evidence that the NetBIOS name is used: >> >> http://msdn.microsoft.com/en-us/library/aa368009(VS.85).aspx >> http://msdn.microsoft.com/en-us/library/ms724295(v=VS.85).aspx >> >> One problem with this approach is that changes to the NetBIOS name >> are not seen by those APIs and variables, e.g. if the machine >> get's an update via DHCP. The other is that NetBIOS itself is >> being phased out in favor of DNS names - which socket.gethostname() >> returns, so we'd be replacing a new technology with an old one. > > I think you misunderstand. It's not that this API returns the NetBIOS > name, but that NetBIOS really uses the same name that people understand > as their "computer name". > > It's incorrect to use DNS names when implementing platform.uname(): > on POSIX, uname() *also* does not return the DNS name. If you want > some API to return the DNS name of the computer, you need a different > function (e.g. socket.getfqdn()).
If think you are misunderstanding. The DNS name of a machine *is* it's node name. >From the gethostname man page: Glibc Notes The GNU C library implements gethostname() as a library function that calls uname(2) and copies up to len bytes from the returned nodename field into name. >> BTW: Why doesn't socket.gethostname() use GetComputerNameEx() >> which does support Unicode ? > > gethostname was specified by Berkeley Unix (4.2BSD specifically). > Microsoft can't just change the signature of the function. > > If you are asking whether Python's socket.gethostname calls > gethostname: because this is the whole point of this function. > It would be very confusing if the function didn't call the > same-named platform API. The MS API returns the DNS name as Unicode, so you don't into those encoding in the first place. I'll close this report as won't fix, since it's not platform.uname() that needs to be fixed, but socket.gethostname() and that's issue 9377. I'll copy the URLs to that issue. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10097> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com