nova proba

Revision:
22:11279d24a105
Parent:
21:2232f5a34eb4
Child:
25:08f20fc5e5b5
diff -r 2232f5a34eb4 -r 11279d24a105 TcpServerToFlash.cpp
--- a/TcpServerToFlash.cpp	Mon May 25 22:19:36 2020 +0200
+++ b/TcpServerToFlash.cpp	Thu Jun 11 10:41:11 2020 +0200
@@ -99,9 +99,9 @@
 
     while(   (p_soc = gp_tcpSocket->accept( &err))  )
     {
-    printf("\n\rTCP WEB SERVER: zahtev za konekciju - socket = %d  err = %d\n\r", p_soc, err);fflush(stdout);
+//    printf("\n\rTCP WEB SERVER: zahtev za konekciju - socket = %d  err = %d\n\r", p_soc, err);fflush(stdout);
     //     s.wait();     // semafor sprecava novu konekciju dok se stara ne zavrsi 
-    printf("TCP WEB SERVER: Broj %d\n\r", ++nos); fflush(stdout);
+  //  printf("TCP WEB SERVER: Broj %d\n\r", ++nos); fflush(stdout);
 
 bws = 1;
 
@@ -111,7 +111,7 @@
             ps_thp->p_Thread = p_thr;
         
         
-            printf("TCPThread: NOVA KONEKCIJA!  thread %d   socket  %d   struct Sst %d\n\r", ps_thp->p_Thread, p_soc, ps_thp);fflush(stdout);
+    //        printf("TCPThread: NOVA KONEKCIJA!  thread %d   socket  %d   struct Sst %d\n\r", ps_thp->p_Thread, p_soc, ps_thp);fflush(stdout);
             p_thr->start( callback( rcpServerInstance_fun, ps_thp ));
 
 while(bws);
@@ -145,7 +145,7 @@
        {        
          extern C_HTMLparse *gpc_html;
 
-            printf("tcpServThread: cekam prijem od klijenta \n\r");
+      //      printf("tcpServThread: cekam prijem od klijenta \n\r");
             SocketAddress sockAddr;
             p_soc->getpeername( &sockAddr );
             
@@ -161,7 +161,7 @@
                if(n>= sizeof(inbuff)) break;
             }
             while( ((n==0) || (nr > 0) ) && k );
-            printf( "tcpServThread: broj  prolaza t=%d   k=%d  n=%d nr=%d\n\r ", t, k, n, nr);
+        //    printf( "tcpServThread: broj  prolaza t=%d   k=%d  n=%d nr=%d\n\r ", t, k, n, nr);
             if( (nr < 0) && (nr != NSAPI_ERROR_WOULD_BLOCK) )   break;
             if( !k ) break;
             
@@ -189,25 +189,21 @@
                     { 
 
      tcpServerBlock = 1;
-       printf("tcpServThread: ___stop komunikacije\n\r");
             
-//                        scomRxThreadCancel();
-   //                      tcpRxThreadsCancel();
-                printf(" STACK: size=%d free=%d used=%d max used=%d\n\r", ps_thp->p_Thread->stack_size(),ps_thp->p_Thread->free_stack(),ps_thp->p_Thread->used_stack(),ps_thp->p_Thread->max_stack());
-          //              udpRxThreadsCancel();
-           //         wait(0.1);
+            //    printf(" STACK: size=%d free=%d used=%d max used=%d\n\r", ps_thp->p_Thread->stack_size(),ps_thp->p_Thread->free_stack(),ps_thp->p_Thread->used_stack(),ps_thp->p_Thread->max_stack());
                          gpc_html->htmlPOST_fun( );   // setovanje parametara u HTML format                         
                          putHTMLintoFLASH( gpc_html );   // upis parametara iz HTMLa u FLASH
  
  //restart_TcpClientsConnection(1);
-restart_TcpClients();
-restart_UdpClients();
-restart_SerialCom( );
+
+
+// restart_TcpClients();
+// restart_UdpClients();
+// restart_SerialCom( );
+
+
+
             // vratiti podatke iz Flasha u HTML !!!!!!
-//         ethRestart( );
-       //     udpRxThreadsRiseUp( );
-         //   scomRxThreadRiseUp( );
-  //          tcpRxThreadsRiseUp( );
             
  restart = 1;
                       }
@@ -225,6 +221,8 @@
 
                     auto html_string = gpc_html->getHTML_free( );  // konvertovanje HTMLa u niz
                     n = p_soc->send(html_string, strlen(html_string));  // slanje HTML-a
+
+
                     printf("tcpServThread: PREDAJA dataBuffer: posato bajtova = %d, %d \n\r", n, strlen(html_string));
                     free(html_string); // oslobadjanje memorije HTML niza
                     }                
@@ -249,6 +247,7 @@
         if( restart )
         {
             printf("tcpServThread:___restart komunikacije\n\r");
+        if(restart) {extern void startUp(void); startUp();}
     //         ethRestart( );
     //    //     udpRxThreadsRiseUp( );
     //         tcpRxThreadsRiseUp( );