In the early days of telephones, you would ring the switchboard operator, who would actually connect your call using a jumper wire. That is all a switch does--direct the connection to only the correct port.
The opposite is a hub, which broadcasts your message to all of the ports at the same time, like a splitter. Supposedly everyone else is supposed to ignore messages intended for someone else--but like a party line they can snoop or eavesdrop. So security is poor. Wifi is a hub too, but just encrypted.
Needless to say, with either a switch or a hub you will need a continuous wire to make a connection. If you own your house it's as easy as drilling two holes in an outside wall and running the wire outside along the side of the house.
Powerline isn't as reliable because you have two 110v branches to your home, and if both devices are on different branches, they will only connect while you are using a 220v appliance like a dryer. You can supposedly solve this with a device called a "phase coupler" but they don't always work. Plus theoretically any of your neighbors served by the same pole transformer might be able to snoop too, if they have the same equipment--a security issue.