FinalVersion Posted April 18, 2010 Share Posted April 18, 2010 If I send "MsgBox" with the client, it works. But then if I try to send anything a second time, it won't work. Why? Server TCPStartup() $mainSock = TCPListen("127.0.0.1", 1030) If $mainSock = -1 Then Exit $sockClient = -1 Do $sockClient = TCPAccept($mainSock) Until $sockClient <> -1 $ret = "" While 1 $ret = TCPRecv($sockClient, 1000) Switch $ret Case "MsgBox" MsgBox(0, "", "MsgBox") $ret = "" Case "Close" ExitLoop $ret = "" EndSwitch WEnd TCPCloseSocket($sockClient) TCPShutdown() Client TCPStartup() $sockMain = TCPConnect("127.0.0.1", 1030) If $sockMain = -1 Then Exit $sNode = InputBox("", "") TCPSend($sockMain, $sNode) TCPCloseSocket($sockMain) TCPShutdown() [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
ChrisL Posted April 18, 2010 Share Posted April 18, 2010 (edited) Updated Server Code $IP = "192.168.2.102" TCPStartup() $mainSock = TCPListen($IP, 1030) If $mainSock = -1 Then Exit $sockClient = -1 $ret = "" While 1 If $sockClient = -1 then $sockClient = TCPAccept($mainSock) _DebugWrite("sockMain = " & $sockClient) Else $ret = TCPRecv($sockClient, 1000) If @error then $sockClient = -1 ;The connection has been closed _DebugWrite("Ret = " & $Ret) Switch $ret Case "MsgBox" MsgBox(0, "", "MsgBox") $ret = "" Case "Close" Exitloop EndSwitch EndIf WEnd TCPCloseSocket($mainSock) TCPShutdown() Func _DebugWrite($vStr = "") ConsoleWrite($vStr & @crlf) EndFunc Edited April 18, 2010 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire 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