Data loss while transfer data within wifi connecting

I’m using photon device and imu shield to receive accel, gyro data.
And, it is connected wifi communication to transfer above data to PC.
When i checked the time from accumulation data to sending data, it is about 270 ms and 4616 byte.
If the device is close to AP router, it’s fine.
But i moved the device little bit far from AP router whthin connected wifi, it is loosing data. ( I know that wifi signal is weak when it is far from router, but it is still maintening wifi connection.)
Sometimes, it is loosing data when it is close to router.
Is there any method or information not to lose data when transfer data within connected wifi?

What kind of transfer protocol are you using?

UDP for example is focused on speed but allows for packet loss, TCP on the other hand introduces some overhead which reduces speed but increases reliability to get all the packets and keeping them in order.

If you don’t need permanent cloud support, you could use one of the non-AUTOMATIC SYSTEM_MODEs and/or SYSTEM_THREAD(ENABLED) for decoupling of cloud and application threads.

BTW, how do you confirm that connection does not cut out for short periods?

1 Like

I’m using TCP protocol to transfer data.
And, i don’t use permanet cloud support by using SYSTEM_MODE(SEMI_AUTOMATIC).

To confirm that connection does not cut out for short periods, i use server socket pc program.
Open the server program, and when the client connection is connected, it transfer data to PC server program about 270ms.

SYSTEM_THREAD(ENABLED) means it makes photon use thread?

Have a read about SYSTEM_THREAD()

But what do you exactly mean with loosing data?
How much data?
Whole data sets or only some bytes of a set?
Do you get currupted data?
Are you actually loosing data or could it be that data acquisition just cuts out and there is not data (instead of existing data lost)?

transfer whole data sets like that.
client.write(reinterpret_cast<byte*>(&Senddata), sizeof(Senddata));

byte is about 4616.
If it is far from router, (it transfer data), some of data value are zero or -1.6E + 38.
While it is clost to router, sometimes it occur data shift.
I think photon sending data, but server pc program couldn’t receive correct data. I’ll check more.
Also, i doubt AP router ability.

You are asking the underlying software to break up your large array into packets for you since the size of your array exceeds a single packet.

Have you tried sending your data in say 1024 byte chunks instead of all at once?