PAULOGARCIA2005 Posted May 21, 2009 Share Posted May 21, 2009 expandcollapse popup;;; SERVER;;; #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### $Form1 = GUICreate("Semáforo", 226, 658, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS)) $Pic1 = GUICtrlCreatePic(@ScriptDir&"\Rojo_b.jpg", 8, 8, 209, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic2 = GUICtrlCreatePic(@ScriptDir&"\Amarillo_b.jpg", 8, 224, 209, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic3 = GUICtrlCreatePic(@ScriptDir&"\Verde_b.jpg", 8, 440, 209, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $Pic1s = 0 $Pic2s = 0 $Pic3s = 0 $op = 0 ;$time = @SEC TCPStartup() $IP = TCPNameToIP('paulogarcia2005.no-ip.biz') MsgBox (0,"IP:",$IP) $MS = TCPListen ($IP,30) If $MS = -1 Then Exit MsgBox (0,"","Esperando al client...") Do $CS=TCPAccept ($MS) Until $CS <> -1 While 1 $nMsg = GUIGetMsg() Switch $nMsg ;Case $op = 1 ; If $time = @SEC+5 Then GUICtrlSetImage ( $Pic1, file($Pic1, $Pic1s)) And $time = @SEC Case $GUI_EVENT_CLOSE TCPShutdown() Exit Case $Pic1 GUICtrlSetImage ( $Pic1, file($Pic1, $Pic1s)) Case $Pic2 GUICtrlSetImage ( $Pic2, file($Pic2, $Pic2s)) Case $Pic3 GUICtrlSetImage ( $Pic3, file($Pic3, $Pic3s)) EndSwitch SetError (0) $TCPR = TCPRecv($CS, 512) If $TCPR = '1' Then GUICtrlSetImage ( $Pic1, file($Pic1, $Pic1s)) If $TCPR = '2' Then GUICtrlSetImage ( $Pic2, file($Pic2, $Pic2s)) If $TCPR = '3' Then GUICtrlSetImage ( $Pic3, file($Pic3, $Pic3s)) ;If $TCPR = '4' Then ; If $op = 1 Then $op = 0 And $ops=1 ; If $op = 0 And $ops= 0 Then $op = 1 And $ops = 0 ;EndIf WEnd Func file($Ctrl, $state) If $state = 0 Then If $Ctrl = $Pic1 Then $Pic1s = 1 Return (@ScriptDir&"\Rojo_a.jpg") EndIf If $Ctrl = $Pic2 Then $Pic2s = 1 Return (@ScriptDir&"\Amarillo_a.jpg") EndIf If $Ctrl = $Pic3 Then $Pic3s = 1 Return (@ScriptDir&"\Verde_a.jpg") EndIf EndIf If $state = 1 Then If $Ctrl = $Pic1 Then $Pic1s = 0 Return (@ScriptDir&"\Rojo_b.jpg") EndIf If $Ctrl = $Pic2 Then $Pic2s = 0 Return (@ScriptDir&"\Amarillo_b.jpg") EndIf If $Ctrl = $Pic3 Then $Pic3s = 0 Return (@ScriptDir&"\Verde_b.jpg") EndIf EndIf EndFunc First Hi. Second. My problem is that when i tray to use the script the script didn't work, it close It closes because this line: If $MS = -1 Then Exit But I don't know why TCPListen returns me an error, it always returns me an error exept when the IP was 127.0.0.1, can you help me please? Sorry for my bad english. Bye. Link to comment Share on other sites More sharing options...
Dampe Posted May 21, 2009 Share Posted May 21, 2009 Another program / service may be running listening on that port on your computer. Do a netstat -a or try another port Link to comment Share on other sites More sharing options...
PAULOGARCIA2005 Posted May 21, 2009 Author Share Posted May 21, 2009 Nothing. I try with a lot of ports but nothing, I dissabled the firewall and still nothing. TCPListen returns me -1 Bye 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