My setup involves a windows pc and a raspberry pi running pi os. I was curious if there is anyway that I can directly link the two together say through the use of an Ethernet cable so that I can avoid my WiFi router. I believe my unstable WiFi is causing my program to get out of sync and stop working.
Yes, you can connect the two using an Ethernet cable. Be sure to turn off wifi first. Then select some private addresses within the same subnet, perhaps 192.168.1.5 is the pi and 192.168.1.6 is the windows pc.
It should work just fine. And you will see improvement over wifi.