Network API
#95
Ooooh, that was quite fast Smile The first actual usage of the Lua API is working:
Code:
[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&amp;ei=hePIVKjQM-ik8wfh0oGYAg">here</A>.
</BODY></HTML>

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
Reply
Thanks given by: NiLSPACE , Seadragon91


Messages In This Thread
Network API - by xoft - 12-31-2014, 04:49 AM
RE: Network API - by NiLSPACE - 12-31-2014, 04:59 AM
RE: Network API - by xoft - 12-31-2014, 05:28 AM
RE: Network API - by wolfmitchell - 01-01-2015, 01:01 PM
RE: Network API - by NiLSPACE - 01-01-2015, 10:11 PM
RE: Network API - by xoft - 01-02-2015, 06:58 AM
RE: Network API - by sphinxc0re - 01-02-2015, 09:26 AM
RE: Network API - by xoft - 01-02-2015, 05:23 PM
RE: Network API - by sphinxc0re - 01-02-2015, 08:45 PM
RE: Network API - by jan64 - 01-05-2015, 01:59 AM
RE: Network API - by wolfmitchell - 01-05-2015, 06:27 AM
RE: Network API - by jan64 - 01-05-2015, 07:22 AM
RE: Network API - by wolfmitchell - 01-05-2015, 08:22 AM
RE: Network API - by xoft - 01-05-2015, 07:46 AM
RE: Network API - by worktycho - 01-05-2015, 09:37 PM
RE: Network API - by xoft - 01-06-2015, 02:02 AM
RE: Network API - by worktycho - 01-06-2015, 02:07 AM
RE: Network API - by worktycho - 01-06-2015, 04:55 AM
RE: Network API - by xoft - 01-06-2015, 06:11 AM
RE: Network API - by xoft - 01-06-2015, 06:46 AM
RE: Network API - by worktycho - 01-06-2015, 06:58 AM
RE: Network API - by xoft - 01-06-2015, 07:18 AM
RE: Network API - by jan64 - 01-06-2015, 08:29 AM
RE: Network API - by worktycho - 01-06-2015, 09:12 AM
RE: Network API - by jan64 - 01-06-2015, 09:14 AM
RE: Network API - by worktycho - 01-06-2015, 09:35 AM
RE: Network API - by jan64 - 01-06-2015, 09:43 AM
RE: Network API - by worktycho - 01-06-2015, 09:53 AM
RE: Network API - by jan64 - 01-06-2015, 10:01 AM
RE: Network API - by worktycho - 01-06-2015, 10:08 AM
RE: Network API - by xoft - 01-06-2015, 06:17 PM
RE: Network API - by jan64 - 01-06-2015, 09:49 PM
RE: Network API - by xoft - 01-09-2015, 07:27 PM
RE: Network API - by NiLSPACE - 01-09-2015, 07:43 PM
RE: Network API - by xoft - 01-09-2015, 08:11 PM
RE: Network API - by xoft - 01-09-2015, 08:36 PM
RE: Network API - by NiLSPACE - 01-09-2015, 09:23 PM
RE: Network API - by jan64 - 01-11-2015, 02:04 AM
RE: Network API - by xoft - 01-12-2015, 07:21 PM
RE: Network API - by NiLSPACE - 01-12-2015, 09:07 PM
RE: Network API - by xoft - 01-12-2015, 09:29 PM
RE: Network API - by NiLSPACE - 01-12-2015, 10:38 PM
RE: Network API - by xoft - 01-12-2015, 10:46 PM
RE: Network API - by NiLSPACE - 01-12-2015, 10:56 PM
RE: Network API - by xoft - 01-12-2015, 11:30 PM
RE: Network API - by NiLSPACE - 01-13-2015, 12:28 AM
RE: Network API - by xoft - 01-13-2015, 12:52 AM
RE: Network API - by NiLSPACE - 01-13-2015, 12:59 AM
RE: Network API - by xoft - 01-13-2015, 01:20 AM
RE: Network API - by NiLSPACE - 01-13-2015, 02:31 AM
RE: Network API - by xoft - 01-13-2015, 05:09 PM
RE: Network API - by xoft - 01-14-2015, 03:06 AM
RE: Network API - by NiLSPACE - 01-14-2015, 04:15 AM
RE: Network API - by worktycho - 01-14-2015, 04:22 AM
RE: Network API - by xoft - 01-14-2015, 05:25 PM
RE: Network API - by worktycho - 01-14-2015, 09:47 PM
RE: Network API - by xoft - 01-14-2015, 11:12 PM
RE: Network API - by xoft - 01-14-2015, 11:18 PM
RE: Network API - by worktycho - 01-14-2015, 11:45 PM
RE: Network API - by NiLSPACE - 01-16-2015, 03:02 AM
RE: Network API - by xoft - 01-16-2015, 06:12 AM
RE: Network API - by NiLSPACE - 01-16-2015, 09:34 PM
RE: Network API - by worktycho - 01-16-2015, 10:02 PM
RE: Network API - by NiLSPACE - 01-16-2015, 10:26 PM
RE: Network API - by xoft - 01-17-2015, 12:09 AM
RE: Network API - by NiLSPACE - 01-17-2015, 12:16 AM
RE: Network API - by NiLSPACE - 01-17-2015, 12:47 AM
RE: Network API - by xoft - 01-17-2015, 01:09 AM
RE: Network API - by xoft - 01-17-2015, 01:13 AM
RE: Network API - by NiLSPACE - 01-17-2015, 01:19 AM
RE: Network API - by xoft - 01-17-2015, 09:55 AM
RE: Network API - by NiLSPACE - 01-17-2015, 10:08 AM
RE: Network API - by xoft - 01-18-2015, 08:48 AM
RE: Network API - by NiLSPACE - 01-18-2015, 09:18 AM
RE: Network API - by xoft - 01-19-2015, 07:45 AM
RE: Network API - by worktycho - 01-19-2015, 08:21 AM
RE: Network API - by xoft - 01-21-2015, 01:16 AM
RE: Network API - by xoft - 01-21-2015, 08:00 PM
RE: Network API - by NiLSPACE - 01-21-2015, 08:17 PM
RE: Network API - by NiLSPACE - 01-23-2015, 01:41 AM
RE: Network API - by xoft - 01-23-2015, 02:30 AM
RE: Network API - by xoft - 01-24-2015, 05:08 AM
RE: Network API - by worktycho - 01-25-2015, 12:00 AM
RE: Network API - by xoft - 01-25-2015, 12:09 AM
RE: Network API - by worktycho - 01-25-2015, 12:24 AM
RE: Network API - by xoft - 01-25-2015, 12:56 AM
RE: Network API - by worktycho - 01-25-2015, 01:00 AM
RE: Network API - by xoft - 01-25-2015, 01:02 AM
RE: Network API - by xoft - 01-25-2015, 06:04 AM
RE: Network API - by xoft - 01-26-2015, 11:53 PM
RE: Network API - by NiLSPACE - 01-27-2015, 05:47 AM
RE: Network API - by xoft - 01-27-2015, 10:59 PM
RE: Network API - by NiLSPACE - 01-28-2015, 12:09 AM
RE: Network API - by xoft - 01-28-2015, 12:21 AM
RE: Network API - by xoft - 01-28-2015, 11:29 PM
RE: Network API - by NiLSPACE - 01-29-2015, 12:04 AM
RE: Network API - by xoft - 01-29-2015, 12:19 AM
RE: Network API - by wudles - 01-29-2015, 07:52 AM
RE: Network API - by xoft - 01-30-2015, 11:04 AM
RE: Network API - by xoft - 01-31-2015, 08:11 AM
RE: Network API - by Raekye - 02-05-2015, 05:45 AM
RE: Network API - by xoft - 02-05-2015, 05:50 AM
RE: Network API - by Raekye - 02-05-2015, 06:36 AM
RE: Network API - by xoft - 02-08-2015, 03:05 AM
RE: Network API - by Howaner - 02-08-2015, 03:52 AM
RE: Network API - by worktycho - 02-08-2015, 04:17 AM
RE: Network API - by Howaner - 02-08-2015, 05:43 AM
RE: Network API - by xoft - 02-13-2015, 05:07 AM
RE: Network API - by NiLSPACE - 02-13-2015, 07:00 AM
RE: Network API - by xoft - 02-13-2015, 07:04 AM
RE: Network API - by NiLSPACE - 02-14-2015, 02:07 AM
RE: Network API - by xoft - 02-14-2015, 02:21 AM
RE: Network API - by NiLSPACE - 02-14-2015, 02:29 AM
RE: Network API - by xoft - 02-14-2015, 08:23 AM
RE: Network API - by NiLSPACE - 02-15-2015, 12:17 AM
RE: Network API - by NiLSPACE - 02-15-2015, 01:45 AM
RE: Network API - by NiLSPACE - 02-15-2015, 11:40 PM
RE: Network API - by xoft - 02-15-2015, 11:54 PM
RE: Network API - by xoft - 02-16-2015, 12:12 AM
RE: Network API - by jan64 - 02-16-2015, 01:45 AM
RE: Network API - by NiLSPACE - 02-16-2015, 02:26 AM
RE: Network API - by NiLSPACE - 02-16-2015, 06:34 AM
RE: Network API - by bearbin - 02-16-2015, 06:35 AM
RE: Network API - by jan64 - 02-16-2015, 07:38 AM
RE: Network API - by xoft - 02-16-2015, 07:57 AM
RE: Network API - by sphinxc0re - 02-16-2015, 08:50 AM
RE: Network API - by NiLSPACE - 02-16-2015, 05:35 PM
RE: Network API - by xoft - 02-16-2015, 06:13 PM
RE: Network API - by xoft - 02-19-2015, 07:23 AM
RE: Network API - by xoft - 02-20-2015, 08:37 AM
RE: Network API - by sphinxc0re - 02-20-2015, 09:23 AM
RE: Network API - by NiLSPACE - 02-20-2015, 05:31 PM
RE: Network API - by Raekye - 02-21-2015, 06:24 AM
RE: Network API - by NiLSPACE - 02-28-2015, 05:13 AM
RE: Network API - by xoft - 02-28-2015, 05:33 AM
RE: Network API - by NiLSPACE - 02-28-2015, 06:54 AM
RE: Network API - by xoft - 02-28-2015, 07:07 AM
RE: Network API - by NiLSPACE - 05-11-2015, 02:32 AM
RE: Network API - by NiLSPACE - 10-01-2015, 11:44 PM
RE: Network API - by xoft - 10-01-2015, 11:59 PM
RE: Network API - by NiLSPACE - 10-02-2015, 12:11 AM
RE: Network API - by xoft - 10-03-2015, 11:18 PM
RE: Network API - by worktycho - 10-03-2015, 11:49 PM
RE: Network API - by NiLSPACE - 11-24-2015, 07:59 PM



Users browsing this thread: 8 Guest(s)