This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: socket.getfqdn() doesn't on Windows
Type: Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: loewis, olson, tim.peters
Priority: normal Keywords:

Created on 2002-09-27 12:32 by olson, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (8)
msg12512 - (view) Author: Robert Olson (olson) Date: 2002-09-27 12:32
On windows, socket.getfqdn() doesn't return a fully qualified 
name. Further, it returns the NETBIOS name (I think they call it 
that) of the computer, not a name that's useful for 

2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on 
Type "help", "copyright", "credits" or "license" for more 
>>> import socket

Python 2.2.1 (from, Windows 2000.

msg12513 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-29 22:23
Logged In: YES 

This is not true; getfqdn returns a fully qualified name
even on Windows. If it doesn't do that on your system, this
reason is different than just being Windows.

Can you please report the outcome of the following calls?

name = _
msg12514 - (view) Author: Robert Olson (olson) Date: 2002-09-29 23:32
Logged In: YES 

Is this what you're looking for?

$ python
Python 2.1.1 (#2, Aug 
23 2001, 10:41:44) 
[GCC 2.95.3-5 (cygwin special)] on 
Type "copyright", "credits" or "license" for more 
>>> import socket
('only', [], 
['', '', ''])

machine & python, same behavior; the one I used before is now on a 
network where it doesn't have a real name).

I've seen this on all the 
Windows machines I've used; it seems like Windows refuses to let the 
DNS-based name come through, if it already thinks it knows the name 
based on the Netbios name of the machine.
msg12515 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-30 07:44
Logged In: YES 

It works fine for me, on an XP system. What Windows version?

In "computer properties/computer name/Change", what do you
see as "complete computer name"? In "more", what is the
"primary domain suffix"? (I only have a German installation,
so I'm uncertain how this reads in an English installation)
I still suspect your machine is misconfigured.
msg12516 - (view) Author: Robert Olson (olson) Date: 2002-09-30 12:01
Logged In: YES 

This is win2k. The "full computer name" doesn't have the full domain; and 
there isn't a primary domain suffix, so that may be what you mean by 

However, when I get IP and DNS information via 
DHCP, I would not expect to have to manually configure the computer 
name each time I use the machine in a differnet place (this is what DHCP 
is for). A DNS lookup on my IP address should give me the full information. 
Sigh, I suspect I may be up against a windows limitation perhaps.
msg12517 - (view) Author: Robert Olson (olson) Date: 2002-09-30 12:51
Logged In: YES 

This is the other thing that bugs me about this problem:

Python 2.1.1 (#2, Aug 23 2001, 10:41:44) 
[GCC 2.95.3-5 
(cygwin special)] on cygwin
Type "copyright", "credits" or "license" 
for more information.
>>> import socket
('only', [], 
['', '', ''])
[], [''])

It doesn't make sense that the first doesn't 
return the full name, while the second does.

msg12518 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-30 15:23
Logged In: YES 

If you get your configuration via dhcp, the DHCP server
should provide you with your domain name as well. If it
doesn't, the DHCP server is misconfigured; ask your
administrator. Do you have any indication that any other
program on your system is capable of computing the domain
suffix you want to see?

The issue with properly resolving a remote system (assuming
'moonbeam' is remote) is a well-known (to me, atleast)
limitation of the Windows Socket library (winsock): if you
are requesting information on the local system, DNS is not
considered. DNS queries are only sent for remote systems.

I'll close this bug as third-party (MS, in this case); if
you later find that there is indeed a Python bug, please
make a new report.
msg12519 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-09-30 16:02
Logged In: YES 

Changed group to "3rd Party", as Martin suggested.
Date User Action Args
2022-04-10 16:05:42adminsetgithub: 37230
2002-09-27 12:32:47olsoncreate