JRowe Posted June 8, 2008 Share Posted June 8, 2008 I want to connect to port 3601, and maintain the connection. I want to be able to send ASCII messages to port 3601, and receive messages from the same. With the code I've been using, it seems the send only works once, and every message thereafter isn't firing. Can anyone point out why this is only working once, and not after the first connect/send/receive session? CODEHotKeySet('a', '_Test') ; Set up an A hotkey to send the message HotKeySet('{ESC}', '_Close') ; Call a close function to close the script when someone presses escape TCPStartup() ; Initialize the TCP functions/library $Socket = TCPConnect(@IPAddress1, 3601) ; Connect to the server If @error Then ; If no connection is made, the server probably is not running, or another error occurs, give an error message to the user MsgBox(0x20,"Connection error", "Unable to connect to " & @IPAddress1 & ":7000") Exit ; Close the script EndIf While 1 $sData = TCPRecv($Socket,3601) If $sData Then ; There has been some data sent. MsgBox(0, "Message Received", $sData) EndIf WEnd Func _Test() TCPSend($Socket,"(+ 1 4)") ; Send the data EndFunc Func _Close() TCPCloseSocket($Socket) ; Close the socket to the server TCPShutdown() ; Deinitialize the TCP functions/library Exit ; Close the script EndFunc [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
JRowe Posted June 8, 2008 Author Share Posted June 8, 2008 (edited) There wasn't anything wrong with the AutoIt side, I just needed to include an escape character at the end of the SubL query. Everything seems to be working fine I'm going to test and see more of how this works. Edited June 8, 2008 by Jrowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] 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