My Ethernet socket isn't working and I'm convinced it has to do with either the socket itself or the cable behind the wall. This picture of my wall sockets (the left the Ethernet socket, the right a phone socket) shows that both seem to be wired to two identical cables behind the wall. (I checked the wiring from the cable to the Ethernet socket which seems ok w.r.t. the color coding.) Is it ok to try to switch sockets, so as to check whether my Ethernet socket works with the cable on the right?
You can't just 'switch sockets' at one end & hope it will work.
Though it looks like they're made up with the same cable - which is a good thing - you don't know where the other end of the phone cable goes. The only thing you can be absolutely certain of is it doesn't go to your Ethernet network.
Ethernet cabling is point-to-point. For each socket you see, there is another at the other end, joined only to your first socket. Phone cabling, on the other hand, may well be split, joined, run off in parallel… anywhere. It's not point to point; it can be parallel or star-networked. Finding a single 'other end' isn't a simple task.
Better entirely to get an Ethernet cable tester and check that the existing cable, sockets and all patch cables are OK.
If not, fix or replace them.
Agreed with other contributor, get an ethernet cable tester, I don't believe the simple ones would be too expensive, certainly cheaper than changing those two cable setups which would provide you with hours of 'entertainment'. Mine consists of two units, each with an rj45 ethernet socket. One sends a signal sequentially along each pin 1 to 8, the other end has 8 little led's which light up in sequence 1 to 8 (if the cable is correct), if there's a break or a mis-wiring you can determine that from the light sequence … or lack thereof if you have a break in one or all.