Is There An Established Way To Send Code Over a Network?
From memory Java applets and COM components could do this (But mostly discontinued due to security reasons)  The approach was mostly based on a pull strategy.  That is Machine B pulled code from Machine A and then executed in Machine B.

OS and application updates (e.g. Windows Update) also do this approach.  They download the update from a different machine and execute locally.