Jump to content
Sign in to follow this  
Marcos

Server Socket PHP e Client Autoit

Recommended Posts

Pessoal eu to fazendo um tste aqui de um servidor socket em PHP e um cliente com Autoit

e nao to conseguindo acessar, to usando o exemplo do Help do autoit

o server socket em PHP ta funcionando normalmente pq ja acesso ele pelo cliente php normalmente

 

OBS:O server php ta em uma maquina Linux virtualizada com IP 192.168.0.40
e o script cliente autoit ta na maquina física e sempre da o erro:

Cloud not connect, Error code: 10060

 

alguém ai tem alguma ideia do que ta acontecendo??

#include <MsgBoxConstants.au3>

; I am the client, start me after the server! (Start first the TCPAccept example script).

Example()

Func Example()
    TCPStartup() ; Start the TCP service.

    ; Register OnAutoItExit to be called when the script is closed.
    OnAutoItExitRegister("OnAutoItExit")

    ; Assign Local variables the loopback IP Address and the Port.
    Local $sIPAddress = "192.168.0.40" ; This IP Address only works for testing on your own computer.
    Local $iPort = 65003 ; Port used for the connection.

    ; Assign a Local variable the socket and connect to a Listening socket with the IP Address and Port specified.
    Local $iSocket = TCPConnect($sIPAddress, $iPort)

    ; If an error occurred display the error code and return False.
    If @error Then
        ; The server is probably offline/port is not opened on the server.
        Local $iError = @error
        MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, Error code: " & $iError)
        Return False
    Else
        MsgBox($MB_SYSTEMMODAL, "", "Connection successful")
    EndIf

    ; Close the socket.
    TCPCloseSocket($iSocket)
EndFunc   ;==>Example

Func OnAutoItExit()
    TCPShutdown() ; Close the TCP service.
EndFunc   ;==>OnAutoItExit

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×