逻辑仅运行一次

编程入门 行业动态 更新时间:2024-10-28 18:30:45
本文介绍了逻辑仅运行一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

此代码有效,但是只有一次,当它返回FAIL时,即使应该返回,也不会再次失败.它确实会继续运行返回ICMP,TCP和UDP IP的第一部分.是不是MySQL连接断开了?任何帮助表示赞赏.谢谢!

This code works but only once, when it returns FAIL it doesn''t return fail again even though it should, however; it does keep running the first part returning ICMP, TCP and UDP IP''s....Is it that the MySQL connection is broken? Any help appreciated. Thanks!

if ( bShowTCP ) { printf("\n -------------------- // -------------------- "); printf("\n TCP Header:"); int *addressValue = new int(); char *address = LIP; inet_pton(AF_INET, address, addressValue); if (ip_header->source_ip == *addressValue) { printf("\n Source IP: %s", "0.0.0.0"); printf("\n Destination IP: %s", ipDest); } else { printf("\n Source IP: %s", ipSrc); printf("\n Destination IP: %s", ipDest); if (mysql_real_connect(conn,"urlock.db.5513143.hostedresource","VendorCheck","Reader1234","urlock",0,NULL,0) !=0) { (mysql_query(conn,"SELECT COUNT(*) FROM tblURLIP WHERE IP = inet_aton(''ipSrc'') And IPStatus = ''1'' And IPMax = ''0''")); my_ulonglong i = 0; res_set = mysql_store_result(conn); my_ulonglong numrows = mysql_num_rows(res_set); LEGIT = mysql_fetch_row(res_set); if (atoi(LEGIT[i]) == 1) { printf("\n PASS: %s\n",LEGIT[i]); //Insert tblIPAccess (mysql_query(conn,"INSERT INTO tblIPAccess (IP , Dwnload) VALUES(inet_aton(''ipSrc''), ''1'')")); //Get Number Of Records (mysql_query(conn,"SELECT COUNT(*) FROM tblURLAccess WHERE IP = inet_aton(''ipSrc'') And Dwnload = ''1''")); my_ulonglong g = 0; res_set = mysql_store_result(conn); my_ulonglong numrows = mysql_num_rows(res_set); TTL = mysql_fetch_row(res_set); //Get Quota (mysql_query(conn,"SELECT (IPQuota) FROM tblURLIP WHERE IP = inet_aton(''ipSrc'') And IPStatus = ''1''")); my_ulonglong h = 0; res_set = mysql_store_result(conn); MX = mysql_fetch_row(res_set); //If Quota and Records Match Set IPMax to 1 or True otherwise do nothing if ((atoi(TTL[g])) < (atoi(MX[h]))) { (mysql_query(conn,"UPDATE tblURLIP SET IPMax ''1'' WHERE IP = inet_aton(''ipSrc'')")); //printf("Maxed! %s\n"); mysql_close(conn); } } else { printf("\n FAIL: %s\n",LEGIT[i]); } //system("\n PAUSE"); } } } break;

推荐答案

在我看来,您关闭连接的代码在一个条件之内.那时我怀疑您没有关闭连接.也许如果您在调试器中逐步执行代码,就可以看到失败的地方? It looks to me like your code to close the connection is inside a condition. I suspect then that you''re not closing your connection. Perhaps if you step through the code in a debugger, you can see where it fails ?

更多推荐

逻辑仅运行一次

本文发布于:2023-10-29 10:47:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539485.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:逻辑

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!