Hello, I'm just wondering what would be the fastest way to make 2 programs communicate if the computers are on the same network and could be connected with any sort of cable?
For example the time required for a message to be sent + acknowledgment would be a minimum? Also, what would be the time order (ms, µs, etc)?
Not necessarily. Imagine a connection that can always transmit data in full duplex at 1 Gbps, no matter the distance. Dumping the string "PING" into this connection will always take 32 nanoseconds. If the opposite end of the connection is 1 m away, then the "PONG" response can never arrive sooner than 32*2+3.33*2 ns. If it's at the antipodes, the response will instead take at least 62.8*2 ms. Increasing the bandwidth tenfold in the first case will significantly reduce the latency. Not so in the second case.
On the other hand, if the message is significantly large compared to the latency of the connection, increasing the bandwidth does reduce the effective latency of the whole system.
So, which should be optimized depends on how large what you want to send is, and how far you want to send it.