Currently, in LanLink.m, the length to read is declared as long to handle potentially the other client sending -1 as the length of a file. However, the current implementation does not handle this case correctly in receivePayloadWithSocket: because the remaining size = -1 is less than CHUNK_SIZE, the length is set to -1, and trigger a crash because -1 gets converted to the max unsigned long.
Hopefully this can be fixed by just setting the read length to CHUNK_SIZE, but CocoaAsyncSocket might throw error due to not being able to read the expected number of bytes if the file size is not a multiple of CHUNK_SIZE.