Post binary data to A Serverside php cgi

Ha, I’m such an idiot !

72 H
84 T
84 T
80 P
47 /
49 1
46 .
49 1
32 
49 1
48 0
48 0
32 
67 C
111 o
110 n
116 t
105 i
110 n
117 u
101 e
13 CR
10 LF
13 CR
10 LF

This is the response from Expect: 100-continue ! I dont think I should be a detective lol, still dont work though :frowning:

Ok, so I got it working :), the above code is fine, it was my php at fault. So, just as a matter of interest, is it ok to use the F macro please ? and seeing as the server doesn’t respond with any data when I send the data in the loop, is it ok to not wait for a response while looping?

Hi @rickpbush

Great news that you got it working!

Yes the F macro is defined (in spark_wiring_string.h) as below, so it does nothing:

#define F(X) (X)

As to not waiting for data in the loop: you know your system best! If there is no data coming back, you should not wait.

Thanks @bko, one final question if you don’t mind. I am sending 32 bytes at a time in my loop. To send a 50K image this takes 32 seconds !

The 50K image takes 7 seconds to send wirelessly from my arduino to my spark using the NRF24L01.

If I could buffer the imahe as it comes in from the arduino into a byte array 50k long, I could then send the entire array at once without having to have a loop. Only problem with this is that the core only has 20K RAM so that is impossible. I have ordered 4 Photons which have 128K RAM. When my Phontons arrive, will I be able to implement my plan to buffer it and send it in one write?

Yes, I think photon will enable larger buffer sizes in situations like this.

I would try sending 1024 bytes at a time and see if that improves things. The maximum WiFi packet size that the Spark Core can handle is just over 1400 bytes, so something around that will lower the amount of overhead processing you have to do. Anything above that will likely just be the same.

Yep, I tried at 1000 bytes per itteration, that cut the time to 17 seconds, I also tried at 5000 but the core said no :slight_smile:

I feel I’m pushing the limits of what this little board can do here so I’m glad the Photons are winding their way to me, I think that they will make this and many projects like it viable.

Thanks to you and @Hootie81 for your help, I’d not have been able to do this without you :slight_smile:

2 Likes

Hi, so at the end did you have a clean code to post to a local webserver using php?

Reason I ask is that I need to implement that, except, I don’t need large amount of data.

Thx
Nuno

@rickpbush - I have exactly the same situation. The client part is done however I am struggling with the PHP at the server. Any chance you could share that PHP script?

Thanks :stuck_out_tongue: