Michael36 Posted October 31, 2005 Share Posted October 31, 2005 Hi all on my server script here i can't seem to get it to recv text i been looking at some examples and can't fig out what is not right would someone have a idea on this prob? thank you Michael While 1 $Msg = GuiGetMsg() If $Msg = $GUI_EVENT_CLOSE Then ExitLoop $recv = TCPRecv($socket, 512 ) If $recv <> "" Then recv ($edit) If $msg = $connect Then Connect($edit) $Socket = TCPAccept( $MainSocket) If $Socket >= 0 Then msgbox(0,"","my server - Client Connected") EndIf WEnd ;---------------connect--------------------------------- Func Connect($edit) $g_IP = "127.0.0.1" TCPStartUp() $MainSocket = TCPListen($g_IP, 65, 100 ) If $MainSocket = -1 Then Exit EndFunc ;------------------RECV------------------------ Func recv ($recv) GUICtrlSetData($edit, GUICtrlRead($edit ) & ">" & $recv & @CRLF) EndFunc Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 31, 2005 Share Posted October 31, 2005 have you managed to connect?your button can't work i think because your using$Msg = GuiGetMsg()andIf $msg = $connect Then Connect($edit)2 different variablesnext thing: why do you build your connect-function with a parameter if you don't need it?Func Connect()this will dosame for the recv-functionyou asked why it won't work:as you call your function with a parameter, you should use the right one if you have to call it this way, which is complete nonsenstry this 1:While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $recv = TCPRecv($socket, 512 ) If $recv <> "" Then recv () If $msg = $connect Then Connect() $Socket = TCPAccept( $MainSocket) If $Socket >= 0 Then msgbox(0,"","my server - Client Connected") EndIf WEnd ;---------------connect--------------------------------- Func Connect() $g_IP = "127.0.0.1" TCPStartUp() $MainSocket = TCPListen($g_IP, 65, 100 ) If $MainSocket = -1 Then Exit EndFunc ;------------------RECV------------------------ Func recv () GUICtrlSetData($edit, GUICtrlRead($edit ) & ">" & $recv & @CRLF) EndFuncthis 1 should worklast but not least: if your function just has 1 line of code why don't you put it in your loop? my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Michael36 Posted October 31, 2005 Author Share Posted October 31, 2005 have you managed to connect?your button can't work i think because your usingand2 different variablesnext thing: why do you build your connect-function with a parameter if you don't need it?Func Connect()this will dosame for the recv-functionyou asked why it won't work:as you call your function with a parameter, you should use the right one if you have to call it this way, which is complete nonsenstry this 1:While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $recv = TCPRecv($socket, 512 ) If $recv <> "" Then recv () If $msg = $connect Then Connect() $Socket = TCPAccept( $MainSocket) If $Socket >= 0 Then msgbox(0,"","my server - Client Connected") EndIf WEnd ;---------------connect--------------------------------- Func Connect() $g_IP = "127.0.0.1" TCPStartUp() $MainSocket = TCPListen($g_IP, 65, 100 ) If $MainSocket = -1 Then Exit EndFunc ;------------------RECV------------------------ Func recv () GUICtrlSetData($edit, GUICtrlRead($edit ) & ">" & $recv & @CRLF) EndFuncthis 1 should worklast but not least: if your function just has 1 line of code why don't you put it in your loop?i'm sorry i have been using autoit for a short time i thought we keep the loop as tight as Possiblelike call things from functions .well thank you for your help learn something new evrytime i psot a prob thanks Michael Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 31, 2005 Share Posted October 31, 2005 no problemif you want, you can have a look at my server (30k clients)http://www.autoitscript.com/forum/index.ph...=ST&f=9&t=17275for your 1-line function:you do need at least 1 line to call your function, so why don't you use your codeline instead of a function-calli'd do that for 1-line functions my little chatmy little encryption toolmy little hidermy unsafe clickbot 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