With all due respect, Paula Bean's answer is wrong.
client 1 does know whether or not client 2 is on the same subnet (layer 3). It doesn't know or care whether it's on a wireless or wired network (layers 1 and 2). It only knows and cares whether it's on the same subnet. Data meant for hosts on the same subnet is sent directly to those hosts, whether they're on a wired or wireless connection, no routing takes place, so the router does not replace the sender's MAC address with it's own MAC address and forward the data from client 1 to client 2. In fact, the routing function of the wireless router is not called in to play at all in this scenario as the data doesn't need to be routed because it's local to the same subnet. The wireless network is merely the physical medium on which the data is sent/recieved but it works like any other network at layers 1, 2, and 3. Data meant for hosts not on the same subnet operate as in scenario A, data meant for hosts on the same subnet operate as in scenario B.
EDIT:
Here's the layer 2 information for a network capture of a wireless client (Client 2) pinging a wired client (Client 1) on my home network. You'll see that the MAC address of the packet from the wireless client (SourceAddress) is the MAC address of the wireless NIC, not the MAC address of the wireless router.
Client 1:
Ethernet adapter Local Area Connection:
Physical Address. . . . . . . . . : 00-21-9B-06-71-B5
Client 2:
Wireless LAN adapter Wireless Network Connection:
Physical Address. . . . . . . . . : 00-22-5F-B0-5E-66
Network Capture:
Ethernet: Etype = Internet IP (IPv4),DestinationAddress:[00-21-9B-06-71-B5],SourceAddress:[00-22-5F-B0-5E-66]
So as you see, because both clients are local to the same subnet, no routing takes place and the packets from the wireless client are sent directly to the wired client and the wireless router performs no routing and no MAC address replacement, and acts soley as the physical medium for intra-subnet communication.
EDIT:
When dealing with intra-subnet traffic the wireless router acts as a layer 2 device (switch). When dealing with inter-subnet traffic the wireless router acts as a layers 3 device (router).
A TCP connection (which underlies HTTP and many other protocols) is uniquely (at a given point in time) defined by 4 parameters:
- The local IP
- The local port
- The remote IP
- The remote port
Even if you make the same request twice simultaneously from the same computer, even with the two IP addresses identical and the destination port identical, the source port will be different.
Likewise, if you have two requests coming from two devices going through the same NAT device, the NAT device will use different source ports. Depending on the device, it may either keep the original source ports (and only change one if there's a conflict), or always assign a new source port independently of the original source port.
The NAT device will then keep for each connection a mapping in its translation table which states that external connection (external IP, external source port, destination IP, destination port) is mapped to internal connection (internal host IP, internal host source port, destination IP, destination port).
Best Answer
Just because hosts A and B chose port 10123 doesn't mean that is the port that the router uses. The router connects to host C from a source port of it's own choosing. So the connection looks more like this: