qwertylol Posted April 16, 2007 Share Posted April 16, 2007 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? Link to comment Share on other sites More sharing options...
qwertylol Posted April 16, 2007 Author Share Posted April 16, 2007 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 ! Link to comment Share on other sites More sharing options...
ScriptUSER Posted April 16, 2007 Share Posted April 16, 2007 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 ! this might give you hints .... #include <IE.au3> _GoogleSearch("autoit beta") Func _GoogleSearch($sString) $sString = StringReplace($sString, " ", "+") ShellExecute("www.google.com/search?q=" & $sString) EndFunc Link to comment Share on other sites More sharing options...
evilertoaster Posted April 16, 2007 Share Posted April 16, 2007 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. Link to comment Share on other sites More sharing options...
qwertylol Posted April 16, 2007 Author Share Posted April 16, 2007 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 ? Link to comment Share on other sites More sharing options...
evilertoaster Posted April 16, 2007 Share Posted April 16, 2007 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 Link to comment Share on other sites More sharing options...
qwertylol Posted April 16, 2007 Author Share Posted April 16, 2007 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? Link to comment Share on other sites More sharing options...
jvanegmond Posted April 16, 2007 Share Posted April 16, 2007 (edited) um, what is a structure?That is irrelevant for now. Don't look inside the function, only learn how to use it. Edited April 16, 2007 by Manadar github.com/jvanegmond 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