jojo.
der titel sagt alles.
ich weiss nicht was an meinem Code noch alles so falsch ist, aber er empfängt definitivimus nur teilantworten.
ich dachte ich hätte es grad noch gefixt gehabt... ääääh kp was ich genau gemacht hab.
vllt bin ich ein bissel noob, aber kann mir trotzdem einer erklären wies besser funktionieren würde
Spoiler anzeigen
also mal so das junge programm:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=..\Proxy.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Global $listen
Global $conns[130][3] ; local, wan, seed
TCPStartup()
$listen = TCPListen("127.0.0.1", 45000, 134)
While True
Sleep(50)
CreateConn()
For $c = 1 To $conns[0][0]
;Von clienten daten
$reqData = TCPRecv($conns[$c][0], 4096, 1)
If @error Then
ConnDelete($c, "Client verloren")
ExitLoop
EndIf
If $reqData <> "" Then
Connect($c, $reqData)
EndIf
;Vom server daten
$resData = TCPRecv($conns[$c][1], 4096, 1)
$error = @error
If $resData <> "" Then
Recive($c, $resData)
EndIf
If $error Then
ConnDelete($c, "Server verloren")
ExitLoop
EndIf
Next
WEnd
Func CreateConn()
$socken = TCPAccept($listen)
If $socken < 1 Then Return 0
$conns[0][0] += 1
$conns[$conns[0][0]][0] = $socken
$conns[$conns[0][0]][1] = 0
$conns[$conns[0][0]][2] = ""
EndFunc
Func Connect($c, $data)
;get data
$add = "0x"
Do
$data &= StringTrimLeft($add, 2)
$add = TCPRecv($conns[$c][0], 4096, 1)
Until $add = ""
$pos = StringInStr($data, "486F73743A20", 2)+12
$host="0x"&StringMid($data, $pos, 2)
Do
$pos+=2
$host&=StringMid($data, $pos, 2)
Until StringMid($data, $pos+2, 4)="0D0A"
$hostname = BinaryToString($host)
;check port
$pos = StringInStr($hostname, ":", 2)
If $pos <> 0 Then
$hostn = StringLeft($hostname, $pos)
$port = StringTrimLeft($hostname, $pos+1)
else
$hostn = $hostname
$port = 80
EndIf
;connect
If $conns[$c][2] <> $hostname Then
$conns[$c][2] = $hostname
TCPCloseSocket($conns[$c][1])
$conns[$c][1] = TCPConnect(TCPNameToIP($hostn), $port)
If @error Then
Return
EndIf
EndIf
TCPSend($conns[$c][1], $data)
If @error Then
TCPCloseSocket($conns[$c][1])
$pos = StringInStr($conns[$c][2], ":", 2)
If $pos <> 0 Then
$hostn = StringLeft($hostname, $pos)
$port = StringTrimLeft($hostname, $pos+1)
else
$hostn = $hostname
$port = 80
EndIf
$conns[$c][1] = TCPConnect(TCPNameToIP($hostn), $port)
If @error Then
Return
EndIf
EndIf
TCPSend($conns[$c][1], $data)
EndFunc
Func Recive($c, $data);THIS FUNCTION IS MUCH SLOWER THAN POSSIBLE & DOESNT RECIVE ALL DATA
;get data
$add = "0x"
Do
Sleep(1000)
$data &= StringTrimLeft($add, 2)
$add = TCPRecv($conns[$c][1], 4096*4096, 1)
Until $add = ""
TCPSend($conns[$c][0], $data);bypass
EndFunc
Func ConnDelete($c, $r)
TCPCloseSocket($conns[$c][0])
TCPCloseSocket($conns[$c][1])
$conns[$c][0] = $conns[$conns[0][0]][0]
$conns[$c][1] = $conns[$conns[0][0]][1]
$conns[$c][2] = $conns[$conns[0][0]][2]
$conns[0][0] -= 1
EndFunc
wenn ich was vergesse kommt das heut mittag oder so, ich geh