![]() |
|
[.NET] Tcp reading while loop not stopping - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Tcp reading while loop not stopping (/showthread.php?tid=3821778) |
Tcp reading while loop not stopping - sanderele1 - Oct 23, 2013 So what my problem is that I have a tcp application, sending a file (in bytes) to my current application, witch (for now) is just supposed to check if the bytes sendt are equal to the bytes recieved. (Sending and reciving in the same application). PHP Code I'v also tried various loops, they all appear to be stuck. Debug log: PHP Code also the sub "a" is just a basic print sub, think of it as Print("Text") Thanks for any help! (in advance :D) * - Only3 - Oct 23, 2013 computer print what u tell him to a("Vars ok") ... a("Recived " & NBR) * - sanderele1 - Oct 23, 2013 What? I dont think you understood my problem. If you look at the code, after the while loop It's supposed to print a("Done looping #2"), it does not print this though, and it seems like the while loop has stopped, or else it would be spamming a("Received" & NBR). My problem is that the sub seems to stop on the while loop, it does not continue on the code after the while loop. * - TheBarret - Oct 23, 2013 (Oct 23, 2013 09:27 AM)sanderele1 Wrote: What? I dont think you understood my problem. If you look at the code, after the while loop It's supposed to print a("Done looping #2"), it does not print this though, and it seems like the while loop has stopped, or else it would be spamming a("Received" & NBR). My problem is that the sub seems to stop on the while loop, it does not continue on the code after the while loop. I usually use 2 tcp connections for data transfer, one to tell the client or server "Its coming..." and in this info header, i keep the total length, filename, crc32 and such, so the receiver end knows when all is done. * - Only3 - Oct 23, 2013 i understood it ! the others print is after > Loop While NBR > 0 and u dont get it means its > 0 * - sanderele1 - Oct 23, 2013 Indeed,I'v tried that. But the problem isn't the Tcp part of it (The file is just to simulate a bunch of bytes). As of the while loop does seem to be stuck. Anyways thanks for your help. .D - Only3, indeed I thought the same thing!, but then the debug menu should be full of "Recieved X", and since it's not it must have stopped or gotten stuck? It seems to be stuck between "Receive" and "Done Looping #2" * - TraptCode - Oct 23, 2013 (Oct 23, 2013 09:46 AM)TheBarret Wrote: I usually use 2 tcp connections for data transfer, one to tell the client or server "Its coming..." and in this info header, i keep the total length, filename, crc32 and such, so the receiver end knows when all is done. So you provide data that a TCP frame already encapsulates in the first place? Redundant. To OP, it is most likely your receive timeout. If it is set to infinite, or a higher number, it is going to hang the loop until another packet is received. Set the timeout to something like 3-5s and after nothing comes in it should exit your loop. * - sanderele1 - Oct 23, 2013 Thank you, I'll try it .D -Character limit- |