Ich hab ein Problem mit TCP. Ich habe folgendes geschrieben,
Spoiler anzeigen
Global $IP = @IPAddress3
TCPStartup()
$Befehl = InputBox("Befehl", "Nachricht: 1;Nachricht" & @LF & "Datei Starten: 2;Dateiname"& @LF & "Datei senden: 3;jetziger Dateiname;späterer Dateiname")
if $Befehl = 3 Then
$teil = StringSplit($Befehl, ';', 1)
$Read = FileRead($teil[2])
Local $bin = StringToBinary($Read)
ConsoleWrite($bin & @LF)
$Befehl = "3;" & $teil[3] & ";"& $bin
EndIf
MsgBox(0, "Sender", $Befehl)
$Socket = TCPListen($IP, 65432)
Do
$Connection = TCPAccept($Socket)
Until $Connection <> -1
TCPSend($Connection, $Befehl)
TCPShutdown()
Spoiler anzeigen
TCPStartup()
$IP = "127.0.0.1"
$Connection = TCPConnect($IP, 65432)
If $Connection < 0 Then
MsgBox(16, "Error", "Konnte keine Verbindung herstellen!")
_Exit()
EndIf
$Recv = TCPRecv($Connection, 1000000)
sleep(1000)
$teil = StringSplit($Recv, ';')
Switch $teil[1]
Case 1
$msg = $teil[2]
Case 2
$msg = "Datei starten"
ShellExecute($teil[2], @ScriptDir, "open")
Case 3
$msg = "Daten Emfangen"
ConsoleWrite(BinaryToString($teil[3]) & @LF)
$q = BinaryToString($teil[3])
FileWrite($teil[2], $q)
Case Else
$msg = "Error"
EndSwitch
MsgBox(0, "Emfänger", $msg)
Func _Exit()
TCPShutdown()
Exit
EndFunc
aber es funktioniert nur manchmal. wenn ich größere Dateien sende, wie compillierte scripte, dann kommt nur ein kleiner teil an.
Ich hoffe, ihr könnt mir sagen, woran das liegt, und mir eine Lösung geben.