StephaneD Posted February 24 Share Posted February 24 Hello, I've a simple socket script in python on a linux machine : import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(('', 6542)) s.listen(5) conn, addr = s.accept() while True: data = conn.recv(1024) if not data: break print data conn.sendall("TEST EMISSION") conn.close() I would like send data with autoit... #include <MsgBoxConstants.au3> Example() Func Example() TCPStartup() ; OnAutoItExitRegister("OnAutoItExit") Local $sIPAddress = "10.40.16.212" Local $iPort = 6542 Opt("TCPTimeout", 3000 Local $iSocket = TCPConnect($sIPAddress, $iPort) If @error Then Local $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Connexion impossible, code d'erreur: " & $iError) Return False Else MsgBox($MB_SYSTEMMODAL, "", "Connection réussie") EndIf TCPCloseSocket($iSocket) EndFunc ;==>Example Func OnAutoItExit() TCPShutdown() EndFunc It doesn't work. I try AUTOIT with AUTOIT it's ok. Python with python too... Some ideas? Thanks in advance Link to comment Share on other sites More sharing options...
Danp2 Posted February 24 Share Posted February 24 Hi.. and welcome to the forums. Unfortunately, "doesn't work" isn't enough details for us to help you. Please provide a more detailed description of what is occurring. I assume that 10.40.16.212 is the IP address of the linux machine. Is it on the same subnet as your Windows machine? Any chance there's a firewall between them? I'm not sure if it's simply a copy / paste issue, but the line containing Opt("TCPTimeout" is missing a closing parentheses. Also, here's the proper way to post code in the future. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
StephaneD Posted February 24 Author Share Posted February 24 Hello, Sorry, TCPConnect return the error code 10060. The two computer aren't in the same subnet but On the same port, and between the same machine two script python work well. For the line Opt it's a mistake in the copy paste. Link to comment Share on other sites More sharing options...
Danp2 Posted February 24 Share Posted February 24 Are you able to ping between the two machines? WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted February 26 Share Posted February 26 Try python on same windows machine to at least see if you locally can connect. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets 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