While translating a technical document I began thinking about socket and outlet. It seems like they're mostly interchangeable. Is that correct? Or is there a difference between the two?
The other answers are being too specific. A socket is something into which something is plugged or fitted (also called a receptacle). An outlet is something that something comes out of.
A light socket is called a light socket because a light bulb is inserted into it. A power outlet is called an outlet because power comes out of it. It could conceivably be called a power socket but this is not usual and is possibly confusing.
Neither of these examples is intended to imply the power doesn't come out of a light socket or that a plug isn't plugged into a power outlet. Those are facts but not related to the terms in question themselves.
If you are in any doubt that context is not enough, just use light socket and power outlet.
In British English, 'socket' is the word that normally describes the place in the wall where you put a plug to connect to the electricity supply. 'Outlet' might conceivably be used in some technical contexts, but it has other meanings too and could be ambiguous.
In American English and when speaking about electrical circuits and devices, a "socket" is something into which a light bulb is screwed, while an "outlet" is something into which electrical cords are plugged.
Light socket: Electrical outlet:
This really does depend on your dialect. This is the first time I have seen this meaning of outlet. I've never heard it before. So if you're writing for a British or Irish audience, socket is your only option.
If you're talking about the endpoint of a logical network connection (such as Berkeley sockets), only the term 'socket' is used. These are never called 'outlets'. Only physical endpoints are ever called 'outlets'.
The official designation in Australia used to be "General Purpose Outlet" (GPO). However, the official designation is NOW "Socket Outlet".