themax90 Posted December 23, 2004 Posted December 23, 2004 I need someone that can help me and tell me how I can listen on port 80 and send the text "test" and receive it and write it to a file. Can someone code this please? Help, your names will be in ANY credits of ANY program that I create using this stuff, just to reassure you all. Agent Smith
Doxie Posted December 23, 2004 Posted December 23, 2004 I know nothing about this kind of script, but may this can help. I found it in another thread, and have added the fix Larry said at the bottom on the same thread. I run it in Scite and it seems to work. What ever it do expandcollapse popup;EXAMPLE SERVER CODE using AU3Xtra.DLL ;====================================== Global $WSABASEERR = 10000 Global $socket = 0 Global $str = "" Dim $myarray[80] Dim $themessage[80] $myarray = "TEST--- Before TCPStartUp " ;Start the TCP abilities ;----------------------- msgBox(0,"Before TCPStartUp" & $myarray, "TCPStartUp" & $myarray) $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPStartUp" ) If @error Or $x[0] = 0 Then $myarray = "TEST--- ERRORING Exiting TCPStartUp FAILED " msgBox(0,"TCPStartUp FAILED" & $myarray, "TCPStartUp FAILED" & $myarray) Exit Endif ;Wait for a connection ;----------------------- $myarray = "TEST--- Before TCPListen " msgBox(0,"Before TCPListen" & $myarray, "TCPListen" & $myarray) $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPListen",_ "str", "10.6.8.90",_ "int", 1025 ) If @error Or $x[0] < 0 Then CleanUp(0) $socket = $x[0] ;Wait to receive data. Loop until "quit" or "" is received, ; or disconnection. ;--------------------------------------------------------- $myarray = "TEST--- Before TCPRecv " msgBox(0,"Before TCPRecv" & $myarray, "TCPRecv" & $myarray) Do $ans = "FROM_GUI_TESTER_HELLO_11" $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPSend", "int", $socket, "str", $ans) $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPRecv", "int", $socket, "str", "", "int" 5535 ) $myarray = "IM =::" & $x[2] & "Msg = " & $themessage msgBox(0,"Mess from TCL: bs = " & $x, "==" & $myarray) ; TCPSend( int<socket>, str<message> ) $ans = "FROM_GUI_TESTER_HELLO_22" ; $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPSend", "int", $socket, "str", $ans) ; Returns # of bytes sent for success, or -1 for failure $ans = "FROM_GUI_TESTER_HELLO_33" $myarray = "Outgoing to TCL1 >>>> Message =::" & $x msgBox(0,"Message TO TCL: bytes = " & $x, "This Equals" & $myarray) $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPSend", "int", $socket, "str", $ans) $ans = "FROM_GUI_TESTER_HELLO_44" $myarray = "Outgoing to TCL2 >>>> Message =::" & $x msgBox(0,"Message TO TCL: bytes = " & $x, "This Equals" & $myarray) $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPSend", "int", $socket, "str", $ans) $err = @error ; If Not $err Then ; If $x[0] >= $WSABASEERR Then ExitLoop ; $answer = "error" ; If $x[2] = "user" Then $answer = @UserProfileDir ; If $x[2] = "noanswer" Then Sleep(30000); Test server not answer ; If $x[2] = "create" Then ; $answer = "Not created :(" ; If FileWriteLine(@Scriptdir & "\file.txt", "Created remotely") Then $answer = "File created :)" ; Endif ; If $x[2] = "delete" Then ; $answer = "File still here :(" ; If FileDelete(@Scriptdir & "\file.txt") Then $answer = "File deleted :)" ; Endif ; If $x[2] = "quit" Then ; $answer = "Server stopped" ; $err = 1 ; Endif ; $x = DLLCall( "C:\AU3Xtra.dll", "int", "TCPSend",_ ; "int", $socket,_ ; "str", $answer) ; EndIf Until $err ;CleanUp() is a wrapper for TCPShutDown ;-------------------------------------- CleanUp($socket) ;FUNCs ;++++++++++++++++++++++++++++++++++++++ Func CleanUp($CU_SOCKET) DLLCall( "C:\AU3Xtra.dll", "int", "TCPShutDown",_ "int", $CU_SOCKET) Exit EndFunc Were ever i lay my script is my home...
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