First, a little background. I have a .net client agent installed on each of the computers on the local network. They interact with my central server [website] also on the same local network.
It is important for my site to find out which of the machines can communicate with each other. For example, machines on one subnet cannot communicate directly with machines on another subnet without configuring routers and the like. But machines on the same subnet must be able to communicate with each other directly.
The problem I am facing is that the LAN setup is similar to Figure 1.

Comp1, Comp2 Comp3 , IP- 192.168.1.2 192.168.1.4. IP- . , Comp4, Comp5 ipaddresses.
, , 2 IP-. , 255.255.255.0, , , Comp1 Comp5, .
, ? , . - , .