Glyph Posted January 14, 2009 Share Posted January 14, 2009 I notice that if in my multi client server, the tcpsends if sent faster then 100ms are sent incorrectly... This has some serious problems with the server and client, if i get about 100 people connect, and there is a 100ms sleep - 100*100 = 10000 which is a 10 second lag... that is ridiculous! now at 50ms = 5 seconds, but still unacceptable. if i get 200 people its still at 10 seconds. Is there a reason for this? here's my code: Func broadcast($type, $misc) Local $i = 0 If $Funnel[0][0] <> 0 Then Do $i += 1 If $Funnel[$i][1] = True Then TCPSend($Funnel[$i][0], $type & "|" & $misc) sleep(50);lag EndIf Until $i = $Funnel[0][0] EndIf EndFunc ;==>broadcast tolle indicium Link to comment Share on other sites More sharing options...
trancexx Posted January 14, 2009 Share Posted January 14, 2009 (edited) I notice that if in my multi client server, the tcpsends if sent faster then 100ms are sent incorrectly... This has some serious problems with the server and client, if i get about 100 people connect, and there is a 100ms sleep - 100*100 = 10000 which is a 10 second lag... that is ridiculous! now at 50ms = 5 seconds, but still unacceptable. if i get 200 people its still at 10 seconds. Is there a reason for this? here's my code: Func broadcast($type, $misc) Local $i = 0 If $Funnel[0][0] <> 0 Then Do $i += 1 If $Funnel[$i][1] = True Then TCPSend($Funnel[$i][0], $type & "|" & $misc) sleep(50);lag EndIf Until $i = $Funnel[0][0] EndIf EndFunc ;==>broadcastIncorrectly how? Try this and see if there would be any writings to console: Func broadcast($type, $misc) Local $i = 0 If $Funnel[0][0] Then Do $i += 1 If $Funnel[$i][1] Then If TCPSend($Funnel[$i][0], $type & "|" & $misc) <> StringLen($type & "|" & $misc) Then; BinaryLen() depending on type of data ConsoleWrite("!: " & $i & @CRLF) EndIf EndIf Until $i = $Funnel[0][0] EndIf EndFunc Edited January 14, 2009 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 14, 2009 Moderators Share Posted January 14, 2009 Not that this has relevance to the question... But why use a Do/Until loop instead of a For/Next ? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xand3r Posted January 14, 2009 Share Posted January 14, 2009 (edited) I notice that if in my multi client server, the tcpsends if sent faster then 100ms are sent incorrectly... This has some serious problems with the server and client, if i get about 100 people connect, and there is a 100ms sleep - 100*100 = 10000 which is a 10 second lag... that is ridiculous! now at 50ms = 5 seconds, but still unacceptable. if i get 200 people its still at 10 seconds. Is there a reason for this? here's my code: Func broadcast($type, $misc) Local $i = 0 If $Funnel[0][0] <> 0 Then Do $i += 1 If $Funnel[$i][1] = True Then TCPSend($Funnel[$i][0], $type & "|" & $misc) sleep(50);lag EndIf Until $i = $Funnel[0][0] EndIf EndFunc ;==>broadcast your func should work just fine the only problem you could have with the sleep is actually in your clients not in your server when you send data very fast from the server it's very easy to overflow the read buffer of tcpread hence your loss of data... try one of 2 things... 1: when you TcpRecv in your clients increase the second parameter ... try something like 1024*20=20k per recv 2:try to call tcprecv faster to prevent it from filling up at all^^ cheers Edited January 14, 2009 by TheMadman Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
Glyph Posted January 15, 2009 Author Share Posted January 15, 2009 (edited) Weird, I tried a sleep(1), rather then 100 and, it works! LOL. I overlooked that, but yeah... it works. Also, was in a hurry on the loop, so did what came to mind first, i'll be optimizing the code once i worked out all the bugs, but im changing it to a for next loop, now. Thank's for your help! The problem was with the tcp sends sending too quickly, so one tcpsend would be fused with the other and sent once. Edited January 15, 2009 by Glyph tolle indicium Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now