Different subnet masks

Solution 1:

So what you present there, is a broken IP configuration. The host could exchange messages at layer 2, but IP connectivity is not possible between the hosts. Note that if your #2 host fell in the range 192.168.0.2-127, there would be no issue. As a general rule, all endpoints in your subnetwork should have consistent masks, though as you can see, there is potentially some wiggle room.

So first off, an IP subnet is just a plain old network (albeit a smaller one). That you carved it out of a larger network is really unimportant in most regards. Just like any network, it will have an Identity (the first address in the range), a range of addresses, and a broadcast address (the last address in the range). In order to send traffic to another network, the traffic must pass through a router. This is true even if the two networks are subnet of a single larger network.

There are usecases where IP addresses are assigned a mask that combines multiple subnets, but these generally occur in routing tables inside routers that connect those networks, or more usefully, routers that connect to your routers several steps upstream. this is called route aggregation or supernetting, and its a useful trick, but only in routers. you would only care about it if you were managing a large number of networks.

Solution 2:

I believe that one way UDP datagrams should work well from PC-1 to PC-2. As TCP requires duplex, it would not work.