Jump to content

Recommended Posts

Posted

If I connect multiple clients to the same port on the sever side of au3 codes,

do I identify between the clients with the data they send?

the data I send is stored in a variable beforehand right? and it has to be a string?

is the string created with function_string?

$var = String (hello world! this is alpha!)

TCPSend ( mainsocket, $var )

is this right?

Posted

If I connect multiple clients to the same port on the sever side of au3 codes,

do I identify between the clients with the data they send?

the data I send is stored in a variable beforehand right? and it has to be a string?

is the string created with function_string?

$var = String (hello world! this is alpha!)

TCPSend ( mainsocket, $var )

is this right?

also,

what should I do if I want au3 to connect to a domain name, like google, and send stuff to the search window and click search?

thank you !

Posted

If I connect multiple clients to the same port on the sever side of au3 codes,

do I identify between the clients with the data they send?

the data I send is stored in a variable beforehand right? and it has to be a string?

is the string created with function_string?

$var = String (hello world! this is alpha!)

TCPSend ( mainsocket, $var )

is this right?

There can be multiple sockets on the same port, each time you use tcpconnect() it shoudl give you a unique one.
Posted

does it mean that the tcp functions themselves grants no way where the connection it from, and I have to find out what my ip is and include it in my "data" to the server, and vice versa,

also, I have to start a listening socket on both side to talk to each other right ?

Posted

humm don't quite understand you... but i'll say yes. Have you read the sample in the help file yet? You may find this snippet helpfull-

Func SocketToIP($SHOCKET)
    Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

    Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _
            "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))
    If Not @error And $aRet[0] = 0 Then
        $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))
        If Not @error Then $aRet = $aRet[0]
    Else
        $aRet = 0
    EndIf

    $sockaddr = 0

    Return $aRet
EndFunc

Which returns the IP adress from the socket

Posted

humm don't quite understand you... but i'll say yes. Have you read the sample in the help file yet? You may find this snippet helpfull-

Func SocketToIP($SHOCKET)
    Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

    Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _
            "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))
    If Not @error And $aRet[0] = 0 Then
        $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))
        If Not @error Then $aRet = $aRet[0]
    Else
        $aRet = 0
    EndIf

    $sockaddr = 0

    Return $aRet
EndFunc

Which returns the IP adress from the socket

um, what is a structure?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...