01-27-2015, 05:47 AM
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.
![[Image: 391b0a9221.png]](http://puu.sh/f40Fh/391b0a9221.png)

 The first actual usage of the Lua API is working:[8863cdd6|14:26:22] Startup complete, took 6040ms!
net client
[af4780c4|14:26:29] Executing console command: "net client"
[af4780c4|14:26:29] Client connection request queued.
[aac7ff14|14:26:29] Connected to google.com:80. Sending HTTP request for front page.
[aac7ff14|14:26:32] Received data from google.com:80:
HTTP/1.0 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.cz/?gfe_rd=cr&ei=hePIVKjQM-ik8wfh0oGYAg
Content-Length: 258
Date: Wed, 28 Jan 2015 13:26:29 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0.02
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.cz/?gfe_rd=cr&ei=hePIVKjQM-ik8wfh0oGYAg">here</A>.
</BODY></HTML>
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

(01-29-2015, 12:19 AM)xoft Wrote: [ -> ]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.

