Đã Hủy

Lua: buffered HTTP sockets (send/receive)

I need a Lua ([url removed, login to view]) function (can use C), that will send an HTTP request, whilst providing send / receive progress 'events'.

For sending the request this can be done be done by buffering the output in combination with a progressEvent function, for receiving this could be done with a similar function called every x bytes read. Additionally an optional callback function would be called once the requested has completed. Coroutines would probably be required.

## Deliverables

Presumably coroutines would be required to separate the socket and progress functions efficiently. i.e. after sending x bytes the socket function routine would release to the progressFunction routine which would then return back to the socket function for it to send the next sequence of buffered data, and so on until the request had been fully sent. The same for receive.

Here's how I'd like the Lua code to function. Note that many such parallel requests will be made in sequence so memory efficiency is important.

httpsock = require ("BufferedHTTP")

request = {method="POST", url="[url removed, login to view]", headers={}, body="requestbytes", buffersize="64"}

progressFunction = function printProgress (bytes)

print (bytes .. " bytes sent; ")

end

callbackFunction = function printResult (response)

print ([url removed, login to view] .. " " .. [url removed, login to view])

-- result would contain error, statusCode, StatusString, headers, body

-- error would be used to report socket/DNS failures

end

response = [url removed, login to view](request,trackProgress,progressFunction,callbackFunction)

-- request is used to construct the HTTP request

-- trackProgress is one of send or receive (the progress function would only be used for either, never both)

- progressFunction is the function to call everytime the send/receive buffer is flushed

- callbackFunction is the function to call when the response is received, but may be nil in which case the response is returned

Kĩ năng: Lập trình C, Cocoa, Kĩ thuật, Linux, Mac OS, MySQL, PHP, Kiến trúc phần mềm, Kiểm tra phần mềm, UNIX

Xem nhiều hơn: use case sequence, socket programming in php, programming lua, programming in lua, parallel programming in c, c# parallel programming, code org 6 d, parallel programming c, callback url, dns org, parallel programming, nil, lua, http request, http post receive, http receiving, send receive data php, construct similar, http post headers, lua code

Về Bên Thuê:
( 10 nhận xét ) Carcassonne, France

ID dự án: #3607697

2 freelancer đang chào giá trung bình $74 cho công việc này

gturi

See private message.

$63.75 USD trong 10 ngày
(1 Nhận xét)
0.0
LORDHULK

See private message.

$85 USD trong 10 ngày
(1 Nhận xét)
2.2