diff --git a/cgi-bin/mqtt_pub_stoc.c b/cgi-bin/mqtt_pub_stoc.c index 55bf4f4..4f907d0 100644 --- a/cgi-bin/mqtt_pub_stoc.c +++ b/cgi-bin/mqtt_pub_stoc.c @@ -25,8 +25,8 @@ int main(int argc, char const *argv[]) mosquitto_lib_init(); // 初始化(固定格式) struct mosquitto *client = mosquitto_new(NULL, true, NULL); // 创建客户端 mosquitto_connect_callback_set(client, connect_callback); // 设置连接回调函数 - // mosquitto_connect(client, "localhost", 1883, 60); // 连接服务器(地址,端口,超时时间) - mosquitto_connect(client, "flykhan.com", 1883, 60); // 连接服务器(地址,端口,超时时间) + mosquitto_connect(client, "localhost", 1883, 60); // 连接服务器(地址,端口,超时时间) +// mosquitto_connect(client, "flykhan.com", 1883, 60); // 连接服务器(地址,端口,超时时间) mosquitto_loop_start(client); // 开启客户端线程 while (isConnected == 0) ; // 等待连接成功(当连接成功后,isConnected会被置为1,然后跳出循环) @@ -45,4 +45,4 @@ int main(int argc, char const *argv[]) } return 0; -} \ No newline at end of file +} diff --git a/cgi-bin/mqtt_sub_ctos.c b/cgi-bin/mqtt_sub_ctos.c index 786cc52..49f37d8 100644 --- a/cgi-bin/mqtt_sub_ctos.c +++ b/cgi-bin/mqtt_sub_ctos.c @@ -150,8 +150,8 @@ int main(int argc, char const *argv[]) mosquitto_message_callback_set(client, on_message); // 设置接收消息回调函数,用于接收到消息后的处理 // 3. 连接mqtt broker - // int flag = mosquitto_connect(client, "localhost", 1883, 60); - int flag = mosquitto_connect(client, "flykhan.com", 1883, 60*60*24*30); // 连接服务器(地址,端口,超时时间) : 超时时间为一个月 + int flag = mosquitto_connect(client, "localhost", 1883, 60); + //int flag = mosquitto_connect(client, "flykhan.com", 1883, 60*60*24*30); // 连接服务器(地址,端口,超时时间) : 超时时间为一个月 if (flag == MOSQ_ERR_SUCCESS) { printf("-----连接MQTT 服务器成功!-----\n"); diff --git a/sql_base/green_house.db b/sql_base/green_house.db index e8bf774..b3ad242 100644 Binary files a/sql_base/green_house.db and b/sql_base/green_house.db differ