For Fanuc robots usually only option is FTP protocol. You can generate .ls program in real time (which is just plain text file), send it through FTP and run with ethernet ip or opcua or other protocol, there are many variants.
You can generate .ls program, test it in roboguide quickly and then sent same .ls to real robot. But of course it's not the same of what you were asking. But you can try to play with ethernet ip and somehow synchronize real and virtual robot trough DO/DI flags through wait command (Virtual move to point - freeze itself, and unfreeze real. Real move to next point, freeze itself and unfreeze virtual. Etc.).
www.robot-forum.com in the WSC-Connect App on Google Play
www.robot-forum.com in the WSC-Connect App on the App Store