Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Normally there's a "services" file in C:\Windows\System32\drivers\etc , it lists out the services running and the port to be used.

However what does the word "service" mean here? It's not the "Windows Service", which could be seen when you run "services.msc". Such 2 lists don't tally.

And, this "services" file content could be outdated -- nobody to update it: programs still can communicate through some port without updating the "services" file, if they have some agreement; also, if some program is not running, some port is not taken, the "Windows services file" is also not updated.

So what is this file for?

Anywhere could I find some documents? Maybe because of the popular file name, I have searched on internet but most links are about "Windows Services"... not this "Windows Services File"...

EDIT:

One more question, since the "services" file can be outdated, is there a way to list out all active "services"?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

This file tells services written by Microsoft what port to use, as well as files that wish to use Windows APIs and/or that file to turn a service name into a port. These service names are defined by the IETF.

Here is an example of instructions to change a port to make room for another SMTP server.

And here is more explanation about the service names:

servicename [in]

A NULL-terminated string that contains the service name or destination port of the host on which to connect for IPv4 or IPv6.

A service name is a string alias for a port number. For example, “http” is an alias for port 80 defined by the Internet Engineering Task Force (IETF) as the default port used by web servers for the HTTP protocol. Possible values for the servicename parameter when a port number is not specified are listed in the following file: %WINDIR%\system32\drivers\etc\services

MSDN - Winsock - WSAConnectByName function

share|improve this answer
2  
Specifically the services file backs the [getservbyname](http://msdn.microsoft.com/en-us/library/windows/desktop/ms73853‌​8(v=vs.85).aspx) API which translates a service name into a socket number. –  Richard Mar 20 '12 at 8:42
    
@Richard: Perhaps, but it doesn't mention services. –  Tom Wijsman Mar 20 '12 at 8:50
    
so this is a Windows Socket concept? sorry i'm not familiar here... is it that Windows Socket is a protocol lower than HTTP, TCP/IP, FTP, so that definition done in Windows Socket level can regulate behaviour on HTTP, TCP/IP, or FTP level? –  athos Mar 20 '12 at 8:50
    
@athos: No, it's no protocol. Windows services just first translate the service name (eg. http) into the service port (eg. 80 for http), then provide that service port to the relevant protocol (TCP/IP). –  Tom Wijsman Mar 20 '12 at 8:51
4  
Sidenote: The naming, usage and format of this file comes from Unix where the file is /etc/services. Microsoft adopted this when they started to replace their proprietary networking protocol Netbeui with the open-source TCP/IP protocols that were becoming more important. See kuro5hin.org/story/2001/6/19/05641/7357 –  RedGrittyBrick Mar 20 '12 at 9:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.