mitchelwb Posted February 18, 2016 Share Posted February 18, 2016 (edited) I'm having issues getting a TCPSend/TCPRecv to work. I'm creating the socket ok, but when I send my XML request over the first time, I get a response that it was invalid. Subsequent requests after that, I get no response from the server at all. I spoke to the sysAdmin for the server and he said that it locked out my port because it received 1000's of requests. But there are no loops in my code and the total time to process the script was 0.94 seconds. Any ideas? createTCP() Func createTCP() TCPStartup() ; Start the TCP service. ; Register OnAutoItExit to be called when the script is closed. OnAutoItExitRegister("OnAutoItExit") Opt("TCPTimeout", 10000) Local $sIPAddress = TCPNameToIP("the.server.com") $iPort = 60008 ; this port is assigned to this app Local $iSocket = TCPConnect($sIPAddress, $iPort) if @error Then Exit EndIf ;get xml request contents $XMLData = GetXMLReq("mydata", "mydata", "mydata", "mydata") ;send xml request TCPSend($iSocket,$XMLData) $Response = TCPRecv($iSocket, 1024) EndFunc Func OnAutoItExit() TCPShutdown() ; Close the TCP service. logit("TCP Shutdown") EndFunc ;==>OnAutoItExit Edited February 18, 2016 by mitchelwb Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2016 Developers Share Posted February 18, 2016 That doesn't look like it is the whole script and doesn't seem to contain anything wrong. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
spudw2k Posted February 18, 2016 Share Posted February 18, 2016 (edited) Agreed. It may be something intrinsic on the server-side; I certainly don't see anything in the snippet you posted that would cause the thousands of requests your sysAdmin "saw". Edited February 18, 2016 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
mitchelwb Posted February 18, 2016 Author Share Posted February 18, 2016 (edited) You guys caught me... it's not the whole script. I removed the getXMLReq function because it contained some lightly sensitive information. But it is a function that literally takes a few parameters and inserts them in to a simple XML string. I also cleaned up my consoleWrite statements to make the script more compact for the site. But otherwise, this is it. Edited February 18, 2016 by mitchelwb Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2016 Developers Share Posted February 18, 2016 (edited) 8 minutes ago, mitchelwb said: But otherwise, this is it. Nah ... there is also a logit() function there, but guess that is for logging the process steps. Either way, this script shouldn't trigger the many packets as state unless the $XMLData contains a real big ass string. Jos Edited February 18, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mitchelwb Posted February 18, 2016 Author Share Posted February 18, 2016 9 minutes ago, Jos said: Nah ... there is also a logit() function there, but guess that is for logging the process steps. Either way, this script shouldn't trigger the many packets as state unless the $XMLData contains a real big ass string. Jos Doh! I thought I stripped those all out! In the interest of completeness, here's is the logit function. I hate concatting name/val pairs for consolewrite Func logIt($desc = "", $val = "") ConsoleWrite(@crlf & $desc & ": " & @crlf & $val & @crlf) EndFunc And the request is pretty simple. A header, a <Request> tag that contains 4 child tags that provide an account number, bill information, and the name of the report I'm requesting. It's not even 200 characters. The resulting XML report i expect to get back is MUCH larger, and I know I'm not looping to capture it all, but just to test the process and get it to work so I can implement it in to the larger project, I just wanted to grab enough to verify I was getting the report. Link to comment Share on other sites More sharing options...
Gianni Posted February 19, 2016 Share Posted February 19, 2016 from the Help about the OPT() command:TCPTimeout: Defines the time before TCP functions stop if no communication. Time in milliseconds before timeout (default=100). I think that the value 10000 for the TCPTimeout that you are using is a bit high (default is 100) this should mean that your fuction insists on calling for 10 seconds before giving up. Pheraps this cause a lot of requests against the server. Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
mitchelwb Posted February 19, 2016 Author Share Posted February 19, 2016 6 hours ago, Chimp said: from the Help about the OPT() command:TCPTimeout: Defines the time before TCP functions stop if no communication. Time in milliseconds before timeout (default=100). I think that the value 10000 for the TCPTimeout that you are using is a bit high (default is 100) this should mean that your fuction insists on calling for 10 seconds before giving up. Pheraps this cause a lot of requests against the server. This timeout sets how long my script runs.. if it doesn't receive a response in those 10 seconds the script exits. And that makes sense in terms of listening and receiving... but are you saying you think it is sending the request file repeatedly in those 10 seconds? I'm not real familiar with sockets, but it seems that sending it repeatedly like that would be a lot like a DDOS (minus the distributed part). Link to comment Share on other sites More sharing options...
Gianni Posted February 19, 2016 Share Posted February 19, 2016 my was just wild guess... I thought that while waiting for the timeout, TCP can make more connection attempts. By better reading around ( https://technet.microsoft.com/en-us/library/cc739819%28WS.10%29.aspx --> TcpMaxConnectRetransmissions) seems that the TCP parameter that determines how many retransmission attempt are performed on an initial TcpConnect is the TcpInitialRtt registry value. So maybe my thought is wrong... sorry. Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
mitchelwb Posted February 19, 2016 Author Share Posted February 19, 2016 7 minutes ago, Chimp said: So maybe my thought is wrong... sorry. No need to apologize. I'm appreciative of any conversation that helps to narrow it down. Link to comment Share on other sites More sharing options...
water Posted February 19, 2016 Share Posted February 19, 2016 You could use a tool like Wireshark to check what exactly goes on. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mitchelwb Posted February 19, 2016 Author Share Posted February 19, 2016 1 hour ago, water said: You could use a tool like Wireshark to check what exactly goes on. I would if I could... I'm using a Linux machine to connect to one VPN, then a windows VM to connect to another VPN... I've not tried it, but some of the guys on my team said that it blows Wiresharks mind. Link to comment Share on other sites More sharing options...
water Posted February 19, 2016 Share Posted February 19, 2016 Can your admins tell you which kind of packets they get (session open, retransmit etc.)? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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