jorgeng Posted May 6, 2008 Posted May 6, 2008 (edited) I'm trying to send an xml-string with the tcp send example in autoit help but it doesn't work, the problem is how i will concatenate the $szData string, how do i do that?: $ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT) Dim $szData ; If there is an error... show it If @error Then MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error) ; If there is no error loop an inputbox for data to send to the SERVER. Else ; InputBox for data to transmit $szData = "<?xml version="1.0" encoding="Windows-1252" ?>" <Signal xmlns="http://borsdata.se/TESSignal.xsd">" <Version>1.0</Version> <SignalType>Entry</SignalType> <PositionType>Long</PositionType> <Instrument>OMXS308D</Instrument> <Strategy>RankorTest</Strategy> <Price>45.00</Price> <Weight>1</Weight> <Comment>Omx Wampa Test...</Comment> </Signal>" ; We should have data in $szData... lets attempt to send it through our connected socket. TCPSend($ConnectedSocket,$szData) ; If the send failed with @error then the socket has disconnected ; ---------------------------------------------------------------- If @error Then ExitLoop Edited May 6, 2008 by jorgeng
ProgAndy Posted May 6, 2008 Posted May 6, 2008 (edited) This way: $szData = '<?xml version="1.0" encoding="Windows-1252" ?>' & @CRLF & _ '<Signal xmlns="http://borsdata.se/TESSignal.xsd">' & @CRLF & _ '<Version>1.0</Version>' & @CRLF & _ '<SignalType>Entry</SignalType>' & @CRLF & _ ... //Edit You should use single quotation for enclosing the string ( ' ), because you already hav " in your Data Edited May 6, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
jorgeng Posted May 7, 2008 Author Posted May 7, 2008 This way:$szData = '<?xml version="1.0" encoding="Windows-1252" ?>' & @CRLF & _'<Signal xmlns="http://borsdata.se/TESSignal.xsd">' & @CRLF & _'<Version>1.0</Version>' & @CRLF & _'<SignalType>Entry</SignalType>' & @CRLF & _ ...//Edit You should use single quotation for enclosing the string ( ' ), because you already hav " in your Data Thanks, i will try it.
jorgeng Posted May 7, 2008 Author Posted May 7, 2008 (edited) I got error when i use this string:$szData = '<?xml version="1.0" encoding="Windows-1252" ?>' & @CRLF & _ '<Signal xmlns="http://borsdata.se/TESSignal.xsd">' & @CRLF & _ '<Version>1.0</Version>' & @CRLF & _ '<SignalType>Entry</SignalType>' & @CRLF & _ '<PositionType>Long</PositionType>' & @CRLF & _ '<Instrument>OMXS30-8GT</Instrument>' & @CRLF & _ '<Strategy>RankorTest</Strategy>' & @CRLF & _ '<Price>1005.00</Price>' & @CRLF & _ '<Weight>1</Weight>' & @CRLF & _ '<Comment>Omx Wampa Test...</Comment>' & @CRLF & _ '</Signal>"' & @CRLF & _ ; We should have data in $szData... lets attempt to send it through our connected socket. TCPSend($ConnectedSocket,$szData)------------------------------D:\Program\AutoIt3\RES.au3 (60) : ==> Error in expression.: $szData = '<?xml version="1.0" encoding="Windows-1252" ?>' & @CRLF & '<Signal xmlns="http://borsdata.se/TESSignal.xsd">' & @CRLF & '<Version>1.0</Version>' & @CRLF & '<SignalType>Entry</SignalType>' & @CRLF & '<PositionType>Long</PositionType>' & @CRLF & '<Instrument>OMXS30-8GT</Instrument>' & @CRLF & '<Strategy>RankorTest</Strategy>' & @CRLF & '<Price>1005.00</Price>' & @CRLF & '<Weight>1</Weight>' & @CRLF & '<Comment>Omx Wampa Test...</Comment>' & @CRLF & '</Signal>"' & @CRLF & $szData = ^ ERROR>Exit code: 1 Time: 30.398 Edited May 7, 2008 by jorgeng
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