Madman Posted October 22, 2006 Share Posted October 22, 2006 Hi, I'm makeing a remote controler for my Mp3 Server I use the TCPRecv/Send Examples to do it. Now the examples close the server if i close the client But i don't want that, I tried If @error Then TCPCloseSocket($ConnectedSocket) insted of If @error Then ExitLoop but that made the CPU to use 100% i also tried TCPShutDown() but that did the same thing.. How can i keep the Server on if i close the client? While 1 ;$msg = GUIGetMsg() ; GUI Closed ;-------------------- ;If $msg = $GUI_EVENT_CLOSE Then ExitLoop ; Try to receive (up to) 2048 bytes ;---------------------------------------------------------------- $recv = TCPRecv( $ConnectedSocket, 2048 ) ; If the receive failed with @error then the socket has disconnected ;---------------------------------------------------------------- If @error Then ExitLoop ; Update the edit control with what we have received ;---------------------------------------------------------------- ; If $recv <> "" Then GUICtrlSetData($edit, _ ; $szIP_Accepted & " > " & $recv & @CRLF & GUICtrlRead($edit)) If $recv == "play" Then Run(@ComSpec & " /c clever play","C:\Program\Clever",@SW_HIDE) If $recv == "pause" Then Run(@ComSpec & " /c clever pause","C:\Program\Clever",@SW_HIDE) WEnd Link to comment Share on other sites More sharing options...
jaenster Posted October 22, 2006 Share Posted October 22, 2006 Do you understand the idea of tcp? Anywhy. This dont work , you have no open socket , but you try to get something...? -jaenster Link to comment Share on other sites More sharing options...
Madman Posted October 22, 2006 Author Share Posted October 22, 2006 Do you understand the idea of tcp?Anywhy. This dont work , you have no open socket , but you try to get something...?Yes i have a open socket, and getting is no prob...it's the If @error Then ExitLoop that is the prob, that part of the code close the server exe when the client exe is closed,but i want the server to stay on... 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