我们知道利用wifi传输图片的头为:
client.send("HTTP/1.1 200 OK\r\n" \
"Server: OpenMV\r\n" \
"Content-Type: image/jpeg\r\n\r\n")
传输json数据的头为:
client.send("HTTP/1.1 200 OK\r\n" \
"Server: OpenMV\r\n" \
"Content-Type: application/json\r\n" \
"Cache-Control: no-cache\r\n" \
"Pragma: no-cache\r\n\r\n")
如何才能在192.168.1.1:8080该端口同时获取图片与数据呢?
不能同时获得。http返回的类型只有一个。
应该通过不同的url返回不同的数据。
那可以分别使用两个端口,如8080和9080,两个端口分别传输图片与数据。
OpenMV是没有多线程多进程的。所以一个main.py不能bind多个端口的。
我试了一下,似乎可行,线性检测端口号就行,就是等待9080端口数据传输完成,再传输8080端口,两个端口数据不能并行传输。