ChrisL Posted July 3, 2008 Share Posted July 3, 2008 (edited) Due to me lending my psychic helmet out, your going to have to provide more information. Maybe posting your whole script is a start. I'm not really sure how it can receive -1 unless you don't have an open connection to the server. Edit: Plus previously you told us it was sending you a reply "unable to read data from the transport connection" Edited July 3, 2008 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...
ChrisL Posted July 3, 2008 Share Posted July 3, 2008 If that is all of it then there is no way that's ever going to work, no one can trouble shoot what they can't see [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...
ChrisL Posted July 4, 2008 Share Posted July 4, 2008 You had stuck bits of code posted off here in all sorts of places that didn't make sense. I have tried to sort it out for you but I don't fully understand what your trying to do. I don't understand why half way through you changed port numbers, did you mean to do this? With me not having access to the server I still can't tell you if it is working properly. Your data string to send was invalid too, I have tried to change it to what I think you were trying to do. Chris expandcollapse popup;CLIENT! Start Me after starting the SERVER!!!!!!!!!!!!!!! ; see TCPRecv example #include <GUIConstants.au3> $i = 0 While $i <= 0 ;=======TCP SEND - START ======================= ; Start The TCP Services ; ============================================== TCPStartUp() ; Set Some reusable info ; -------------------------- ; Dim $szServerPC = @ComputerName Dim $szServerPC = "66.66.66.66" MsgBox(4096, "Server", $szServerPC) ; Set $szIPADDRESS to wherever the SERVER is. We will change a PC name into an IP Address Dim $szIPADDRESS = TCPNameToIP($szServerPC) Dim $nPORT = "6920" MsgBox(4096, "Port", $nPORT) ; Initialize a variable to represent a connection ; ============================================== Dim $ConnectedSocket = -1 ; Attempt to connect to SERVER at its IP and PORT ; ======================================================= $ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT) ; If there is an error... show it If @error Then MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error & @crlf & "Client will now exit") TCPShutdown() Exit EndIf ; If there is no error loop an inputbox for data to send to the SERVER. ; Dim $szData #cs;;;; ***********************************************There is an issue with this string value*************************************************** $szData = '<?xml version="1.0" encoding="Windows-1252" ?>' & @CRLF & _ '<Signal xmlns="http://borsdata.se/TESSignal.xsd">' & @CRLF & _ '<Version>1.0</Version>' '</Signal>"' #ce $szData = '<?xml version="1.0" encoding="Windows-1252" ?>' & @CRLF & _ '<Signal xmlns="http://borsdata.se/TESSignal.xsd">' & @CRLF & _ "'<Version>1.0</Version>' '</Signal>""" Msgbox(4096,"Sträng till TCP", $szData) ; We should have data in $szData... lets attempt to send it through our connected socket. MsgBox(4096, "TCPSend gjord", $nPORT) $szDataLen = StringLen($szData) $cnt = TCPSend($ConnectedSocket,$szData) If @error Then ExitLoop ; If the send failed with @error then the socket has disconnected ; ---------------------------------------------------------------- If $szDataLen = $cnt Then MsgBox(4096, "Sent the correct amount of data", $nPORT) Else MsgBox(4096, "Didn't send the correct amount of data or there was an error", $nPORT) Endif TCPCloseSocket($ConnectedSocket);Close the connection as were changing ports? ;*************************************************Why are we changing the port and server connection here?************************************************* ; Skikcar på port 6921 frågor. Dim $nPORT = "6921" MsgBox(4096, "Port", "We have now changed port to " & $nPORT) ; Initialize a variable to represent a connection ; ============================================== Dim $ConnectedSocket = -1 ; Attempt to connect to SERVER at its IP and PORT 33891 ; ======================================================= $ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT) If @error Then MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error & @crlf & "Client will now exit") TCPShutdown() Exit EndIf ; $szData = 'signal;RTest' $szData = 'info;RTest' Msgbox(4096,"Sträng till TCP", $szData) $szDataLen = StringLen($szData) $cnt = TCPSend($ConnectedSocket,$szData) If $szDataLen = $cnt Then MsgBox(4096, "Sent the correct amount of data", $nPORT) Else MsgBox(4096, "Didn't send the correct amount of data or there was an error", $nPORT) Endif MsgBox(4096, "TCPSend gjord på port 6921", $nPORT) $recv = "" While $recv = "" $recv &= TCPRecv($ConnectedSocket,2048) If @error Then exitloop Else Msgbox(4096,"Server Reply",$recv) Endif WEnd ;Msgbox(0,@error,$recv) Wend [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...
jorgeng Posted July 7, 2008 Author Share Posted July 7, 2008 (edited) Thanks Chris. Well, first i shall send a xml message at port 6920 (the stock-order), then i put in a new question which isn't xml just two letter 'info;RTest' and send it at port 6921 which give me the result from the transaction at port 6920. The result from port 6921 will be how many stocks do i have in total and so on. My problem is that i don't get any result-message at port 6921. The box Server reply is empty?? muttley Edited July 7, 2008 by jorgeng Link to comment Share on other sites More sharing options...
LarryDalooza Posted July 7, 2008 Share Posted July 7, 2008 when you...send a xml message at port 6920I assume it sends a acknowledgment reply that you must receive to know that the request was accepted... only then do you communicate on 6921.Lar. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
jorgeng Posted July 7, 2008 Author Share Posted July 7, 2008 when you...I assume it sends a acknowledgment reply that you must receive to know that the request was accepted... only then do you communicate on 6921.Lar.Not really, the documentation says sending xml-string at port 6920 and port 6921 is a standalone check port.But my problem is really i don't know how tcp works in autoit. I assumed that i would get some message from port 6921and that it would come in the "Server reply " box, but i don't really know if this would work??Msgbox(4096,"Server Reply",$recv) muttley Link to comment Share on other sites More sharing options...
ChrisL Posted July 7, 2008 Share Posted July 7, 2008 Not really, the documentation says sending xml-string at port 6920 and port 6921 is a standalone check port.But my problem is really i don't know how tcp works in autoit. I assumed that i would get some message from port 6921and that it would come in the "Server reply " box, but i don't really know if this would work??Msgbox(4096,"Server Reply",$recv) muttleyWhat I wrote above works OK with a simulated server (ie. I can send and receive data), but not having access to the proper server or information I can't really help you much. [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...
ChrisL Posted July 7, 2008 Share Posted July 7, 2008 Do I need the ini file too?, you can PM it to me if you'd rather not post it here [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...
ChrisL Posted July 7, 2008 Share Posted July 7, 2008 Do you have any more documentation? It connects with the server but it doesn't like the xml I think, then when you do the 'info;RankorTest' send the server eventually closes the connection. [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...
ChrisL Posted July 9, 2008 Share Posted July 9, 2008 Chris, i sent you the documenation as a message, two word-documents.RegardsUnfortunately that document doesn't actually tell you very much.All I ever get from the server is "unable to read data from the transport connection" [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...
jorgeng Posted July 9, 2008 Author Share Posted July 9, 2008 Unfortunately that document doesn't actually tell you very much.All I ever get from the server is "unable to read data from the transport connection"Well, i don't know what to do now.That's all information i has... muttley Link to comment Share on other sites More sharing options...
jorgeng Posted July 9, 2008 Author Share Posted July 9, 2008 (edited) Well, i don't know what to do now.That's all information i has... I put in a message about connected socket and it changes every time i debug, it's now 552.My support guy on receiving server says that i shall get message at the same socket at port 6921,what that means...How do you see the error message?I saw an error in code, fixed it - the last line in send-string should be:'</Signal>' muttley Edited July 9, 2008 by jorgeng Link to comment Share on other sites More sharing options...
ChrisL Posted July 9, 2008 Share Posted July 9, 2008 I put in a message about connected socket and it changes every time i debug, it's now 552.My support guy on receiving server says that i shall get message at the same socket at port 6921,what that means...How do you see the error message?I saw an error in code, fixed it - the last line in send-string should be:'</Signal>' muttleyYou can't do that. You cant have a single socket connected to 2 ports as far as I know.Can't you ask the support guy what "unable to read data from the transport connection" means, also confirm they are expecting plain text as it is (or binary) with no other data or header/footer.I get the error message because I checked the port "6920" for a reply before moving on to the next port and that is where I get the reply "unable to read data from the transport connection". [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