I tried testing it, but when I used restart to update the webadmin users I got this error:
![[Image: 391b0a9221.png]](http://puu.sh/f40Fh/391b0a9221.png)
After that the server wasn't responding to anything.
![[Image: 391b0a9221.png]](http://puu.sh/f40Fh/391b0a9221.png)
After that the server wasn't responding to anything.
|
Network API
|
|
I tried testing it, but when I used restart to update the webadmin users I got this error:
![]() After that the server wasn't responding to anything.
01-27-2015, 10:59 PM
Nice catch. Both errors (socket not freed and server not aborting on error) should be fixed in 0edf7ceb28b289f96314bb9b2f7030b61ba4f313.
Thanks given by: NiLSPACE
01-28-2015, 12:09 AM
Great, everything worked for me exept that.
01-28-2015, 12:21 AM
I've rebased the branch on top of current master. I guess I'll start a parallel branch with the Lua API in the meantime, until we have more confirmations that the migration is working properly.
Thanks given by: NiLSPACE
01-28-2015, 11:29 PM
Ooooh, that was quite fast
The first actual usage of the Lua API is working:Code: [8863cdd6|14:26:22] Startup complete, took 6040ms!And this is the complete code from the plugin:
function HandleConsoleNetClient(a_Split)
-- Get the address to connect to:
local Host = a_Split[3] or "google.com"
local Port = a_Split[4] or 80
-- Create the callbacks "personalised" for the address:
local Callbacks =
{
OnConnected = function (a_Link)
LOG("Connected to " .. Host .. ":" .. Port .. ". Sending HTTP request for front page.")
a_Link:Send("GET / HTTP/1.0\r\nHost: " .. Host .. "\r\n\r\n")
end,
OnError = function (a_ErrorCode, a_ErrorMsg)
LOG("Connection to " .. Host .. ":" .. Port .. " failed: " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")")
end,
OnReceivedData = function (a_Data)
LOG("Received data from " .. Host .. ":" .. Port .. ":\r\n" .. a_Data)
end,
}
-- Queue a connect request:
local res = cNetwork:Connect(Host, Port, Callbacks)
if not(res) then
LOGWARNING("cNetwork:Connect call failed immediately")
return true
end
return true, "Client connection request queued."
end
Thanks given by: NiLSPACE , Seadragon91
01-29-2015, 12:04 AM
That's awesome
01-29-2015, 12:19 AM
I pushed all the code in a new PR. The cNetwork::Connect() function and cTCPLink class are more or less complete. I also pushed the network plugin test code as a new plugin, NetworkTest.
01-29-2015, 07:52 AM
01-30-2015, 11:04 AM
I've got server functionality exported as well, it seems to work nicely. I have written two servers, the traditional Echo server, and a Text-Fortune server.
There's only one problem that I've run into now. Object ownership. Sometimes we want Lua to own the object (so that it is garbage-collected), and sometimes we want the same object to direct its own lifetime. This will need some detailed thinking.
I think it should be all sorted out, I've been testing with the NetworkTest plugin and it all seems to work. Feel free to review and comment on the PR: https://github.com/mc-server/MCServer/pull/1718
There's still an issue of missing documentation for the new classes. That will be a tough one, with the callback tables being returned in a callback from a table ![]() Bah! It still doesn't compile on Linux
|
|
« Next Oldest | Next Newest »
|