Data loss safe communication between two machines

61 views Asked by At

I have two application running on two separate (windows) machine. I need a robust communication solution between the two application, which can tolerate short communication channel disconnection (e.g. restart of receiver application) without data loss. The obvious solutions I can come up with:

  • communicate through TCP sockets when connection established and buffering to memory or file while disconnected.
  • communicate through files on one of the machine and use file transfer protocol (e.g. smb) to access from the other computer. Using files to signal file read/write positions.

Is there any other alternative? What are the pros/cons of them? Are there any existing C/C++ libraries implementing a solution?

1

There are 1 answers

0
gabhijit On

Certainly your preferred choice should be TCP. Because TCP would guarantee that whatever appears to the application as sent would be received. In general any connection oriented protocol would do and TCP is the obvious best choice here.

In your second option - there seem to be lot of moving parts (eg. sending a file - some notification to the application new file is received or application polling for file change and then reading that file etc.) and one of them going wrong isn't very unlikely. I am not sure what SMB uses - but if SMB is using TCP, aren't you just better off just using TCP. So files using SMB is certainly not a preferred option. IMO.