Moin
Wozu es gut sein soll ist im moment völlig unwichtig. Es geht darum den Webzugriff auf einen selbstgemachten Proxy umzuleiten.
Ich weiss dummerweise nicht wie man das anstellen muss. Im moment ist das problem, dass ich nicht weiss wann der Server alle daten gesendet hat.
Das script ladet und ladet und ladet... TCPRecv gibt nie @error zurück..
Mein Bisheriges Proxy-skript:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=..\Proxy.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
If $CmdLine[0] = 0 Then
MsgBox(16, "ManiProx - Fehler", "Das Programm benötigt eine Konfigurationsdatei.")
Exit
EndIf
ConfigLoad($CmdLine[1])
TCPStartup()
$SOCKET_local = TCPListen("127.0.0.1", $PORT_local)
While True
$CONN_local = TCPAccept($SOCKET_local)
If $CONN_local <> -1 Then Proxy_main()
Sleep(50)
WEnd
Func Proxy_main()
$HEADER_local = TCPRecvAll($CONN_local)
$ar = StringRegExp($HEADER_local, "Host: ([\w\W]*?)\r\n", 3)
$server = $ar[0]
FileWrite("temp.txt", $HEADER_local)
$CONN_external = TCPConnect(TCPNameToIP($server), $PORT_external)
If @error Then MsgBox(48, "ManiProx - Fehler", "Verbindungsfehler: "&@error)
TCPSend($CONN_external, $HEADER_local)
Do
ToolTip("Daten empfangen")
$recv = TCPRecv($CONN_external, 4092*4092)
$err = @error
FileWrite("recv.txt", $recv)
TCPSend($CONN_local, $recv)
Until @error Or $err
ToolTip("")
TCPCloseSocket($CONN_external)
TCPCloseSocket($CONN_local)
EndFunc
Func ConfigLoad($file)
If not FileExists($file) Then
MsgBox(16, "ManiProx - Fehler", "Die Konfigurationsdatei "&$file&" fehlt.")
Exit
EndIf
Global $PORT_local = FileReadLine($file, 1)
Global $SERVER_external = FileReadLine($file, 2)
Global $PORT_external = FileReadLine($file, 3)
EndFunc
Func TCPRecvAll($sock)
$data = ""
Do
$recv = TCPRecv($sock,4092*4092)
$data &= $recv
Until $recv = ""
Return $data
EndFunc
Ich hoffe dass jemand mehr weiss als ich