When an application wants to use the network it asks the OS to open a socket, which is associated with source and destination IP addresses/ports.
An Internet socket is characterized by a unique combination of the
Local socket address: Local IP address and port number
Remote socket address: Only for established TCP sockets. As discussed
in the client-server section below, this is necessary since a TCP
server may serve several clients concurrently. The server creates one
socket for each client, and these sockets share the same local socket
Protocol: A transport protocol (e.g., TCP, UDP, raw IP, or
others). TCP port 53 and UDP port 53 are consequently different,
When you change your network connection usually you get a different IP address, thus the earlier opened socket becomes invalid for the new connection. You'll only achieve what you want if you find a way to keep the same IP address for both wired and wireless connections.