algiuxas Posted August 13, 2015 Posted August 13, 2015 (edited) Hello, I have a problem, I downloaded example of TCP Server and Client, but client doesn't work, It shows TCPConnect 10060 error (timeout), I tried to turn on two servers, I think server work, because one server show 10048 error(Address already in use) I don't know why it doesn't work, I edited that script, but it doesn't work still. I tried TCPConnect and TCPAccept from AutoIt3\Examples\Helpfile, but TCPConnect shows error 10060(timeout)... Anybody knows how to fix it? Thanks ; SERVER #include <Array.au3> TCPStartup() Dim $Socket_Data[1] $Socket_Data[0] = 0 $Listen = TCPListen(@IPAddress1, 1018, 500) If @error Then ConsoleWrite('!-->['&@Hour&":"&@MIN&":"&@SEC&'] TCPListen error. ( ' & @error & ' )' & @CRLF) Exit EndIf While 1 For $x = $Socket_Data[0] To 1 Step -1 $Recv = TCPRecv($Socket_Data[$x], 1000000) If $Recv Then MsgBox(0, 'Client Number ' & $x & ' with connected socket identifier ' & $Socket_Data[$x], "["&@Hour&":"&@MIN&":"&@SEC&"]"&' Recived msg from Client: ' & @CRLF & $Recv, 5) TCPSend($Socket_Data[$x], 'bye') TCPCloseSocket($Socket_Data[$x]) _ArrayDelete($Socket_Data, $x) $Socket_Data[0] -= 1 EndIf Next _Accept() WEnd Func _Accept() Local $Accept = TCPAccept($Listen) If $Accept <> -1 Then _ArrayAdd($Socket_Data, $Accept) $Socket_Data[0] += 1 EndIf EndFunc ;==>_Accept exit; CLIENT $Connected = False TCPStartup() ; Start TCP. $timespentconnecting = TimerInit( ) Do $Socket = TCPConnect(@IPAddress1, 1018) ; Connect to server. $nERROR = @error ; TCPConnect @error. If not $nERROR Then ; If client connected to server. $Connected = True Else ; If TCPConnect didn't connected to server. ConsoleWrite( "["&@Hour&":"&@MIN&":"&@SEC&"] TCPConnect error. {CODE:" & $nERROR & "}"&@CRLF ) ; Show error. EndIf sleep(100) ; Sleep 0.1 secounds. Until $Connected = True or TimerDiff( $timespentconnecting ) > 10000 ; If client connected or timer > 10 secounds, stop trying connect to server. If $Connected = False then exit ; If client didn't connected to server, exit. TCPSend($Socket, 'Hi there. My computer name is' & ", " & @ComputerName & ", and its drive serial is " & DriveGetSerial(@HomeDrive)); Send to server data. Do ; Loop until client recives data from server. $Recv = TCPRecv($Socket, 1000000) ; Recive data from server. Until $Recv ; Stop looping when data recived from server. MsgBox(0, "["&@Hour&":"&@MIN&":"&@SEC&"] Recived from server:", $Recv); Show recived data from server. Exit(0) ; Exit. Edited August 15, 2015 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore.
JohnOne Posted August 14, 2015 Posted August 14, 2015 It's my guess, you have no takers because you did not post your code here, in tags.It's not hard. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jvds Posted August 16, 2015 Posted August 16, 2015 from what you explained, it seems to me you did run one without running the other one, you can try to compile one and run it, then run the second one from scite or run bouth compiledIf you will try to get it work from 2 computers then run the server on one computer and the client on the other computer, but before you run the client, you need to replace the @IPAddress1 with the IP address of the computer where the server is runningin bouth cases you need to let your firewall allow auto-it access your network when it ask for it, if compiled it till ask you to give acces to the compiled exe
algiuxas Posted August 16, 2015 Author Posted August 16, 2015 from what you explained, it seems to me you did run one without running the other one, you can try to compile one and run it, then run the second one from scite or run bouth compiledIf you will try to get it work from 2 computers then run the server on one computer and the client on the other computer, but before you run the client, you need to replace the @IPAddress1 with the IP address of the computer where the server is runningin bouth cases you need to let your firewall allow auto-it access your network when it ask for it, if compiled it till ask you to give acces to the compiled exeMy firewall is always off. I compiled them, but still, it doesn't work. I will try later run server on one computer and client on other computer.Thanks jvds After switching years ago to Linux, sadly I don't use AutoIt anymore.
jvds Posted August 16, 2015 Posted August 16, 2015 I tried your code and it worked on my computer, are you running it on a computer with user limits or something like that?
algiuxas Posted August 17, 2015 Author Posted August 17, 2015 I tried your code and it worked on my computer, are you running it on a computer with user limits or something like that?I'm administrator, I just found one thing, Internet Explorer isn't working, I always used Mozzila Firefox.I will try to reinstall Internet Explorer, maybe this will help. After switching years ago to Linux, sadly I don't use AutoIt anymore.
algiuxas Posted August 18, 2015 Author Posted August 18, 2015 I'm administrator, I just found one thing, Internet Explorer isn't working, I always used Mozzila Firefox.I will try to reinstall Internet Explorer, maybe this will help.Internet Explorer works now, but AutoIt TCPConnect still won't work, same error, client can't connect to server, 10060 - timeout. After switching years ago to Linux, sadly I don't use AutoIt anymore.
jvds Posted August 18, 2015 Posted August 18, 2015 I don't think the auto it TCP functions are Internet explorer Dependant, something else must be wrong, try this lets see what happens xDTCPStartup() $SrvMainsocket = TCPListen(@IPAddress1, 4321, 100) if @error Then consolewrite("!TCPLISTEN FAILED"&@lf) Else consolewrite("TCPLISTEN pass"&@lf) EndIf $CliSocket = TCPConnect(@IPAddress1,4321) if @error Then consolewrite("!TCPConnect FAILED"&@lf) Else consolewrite("TCPConnect pass"&@lf) EndIf $SrvSubsocket= TCPAccept($SrvMainsocket) if @error Then consolewrite("!$SrvSubsocket FAILED"&@lf) Else consolewrite("$SrvSubsocket pass"&@lf) EndIf TCPShutdown()
algiuxas Posted August 19, 2015 Author Posted August 19, 2015 (edited) This is what i get:TCPLISTEN pass (PING:1/OFFLINE|TCPListen:1724) !TCPConnect FAILED (PING:1/OFFLINE|TCPConnect:-1) $SrvSubsocket pass (PING:1/OFFLINE|TCPAccept:-1)RPC_S_INVALID_NETWORK_OPTIONS1724 (0x6BC)The network options are invalid. Edited August 19, 2015 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore.
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