Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending commands from Android+Tasker to QM
#5
Test powershell code
 
Code:
Copy      Help
cls
$filePath = "$home\desktop\Test\Doc.docx"

$fileBytes = [System.IO.File]::ReadAllBytes($filePath)
$fileBase64 = [Convert]::ToBase64String($fileBytes)

$formData = @{
    "fileName" = "Doc.docx"
    "fileBase64" = $fileBase64
}

Invoke-RestMethod -Uri "http://127.0.0.1:5032/saveFile" -Method Post -Body $formData -ContentType 'multipart/form-data'


 Function QM_TcpSocket_server
Code:
Copy      Help
if(getopt(nthreads)>1) ret
AddTrayIcon "cut.ico" "test_TcpSocket_server[]Ctrl+click to end."

#compile "__TcpSocket"
TcpSocket x.ServerStart(5032 &sub.OnClientConnected)

#sub OnClientConnected
function TcpSocket&client $clientIp param !*reserved

;Test file(Pic.png) size is 1342KB; file(Doc.docx) size is 525KB

;The response speed is very fast, but The data reception is unstable, sometimes complete and sometimes incomplete.
client.Receive(_s 2048000)

;The response speed is too slow, but The received data is always complete, the response speed is still very slow even when testing locally.
;client.Receive(_s 0)

out F"SERVER: client request:[]{_s}"

str r="File saved"
client.Send(F"HTTP/1.1 200 OK[]Content-Type: text/plain[]Content-Length: {r.len}[][]{r}")


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)