Try existing libraries for this type of data transfer - Arduino EasyTransfer is one I have worked with before.