minizbot2012, on 17 July 2012 - 08:45 PM, said:
Absolutely. I'll see about updating those tonight. They aren't too badly out of date, but the documentation needs updating due to the sockets model taking the place of named servers.
Posted 17 July 2012 - 08:47 PM
minizbot2012, on 17 July 2012 - 08:45 PM, said:
Posted 17 July 2012 - 08:48 PM
Lyqyd, on 17 July 2012 - 08:47 PM, said:
minizbot2012, on 17 July 2012 - 08:45 PM, said:
Posted 18 July 2012 - 03:42 AM
minizbot2012, on 17 July 2012 - 08:48 PM, said:
Lyqyd, on 17 July 2012 - 08:47 PM, said:
minizbot2012, on 17 July 2012 - 08:45 PM, said:
Posted 18 July 2012 - 07:21 PM
Lyqyd, on 18 July 2012 - 03:42 AM, said:
minizbot2012, on 17 July 2012 - 08:48 PM, said:
Lyqyd, on 17 July 2012 - 08:47 PM, said:
minizbot2012, on 17 July 2012 - 08:45 PM, said:
Posted 19 July 2012 - 12:08 AM
Posted 19 July 2012 - 09:55 PM
Posted 20 July 2012 - 02:59 AM
minizbot2012, on 19 July 2012 - 09:55 PM, said:
Posted 20 July 2012 - 11:21 AM
Posted 29 August 2012 - 03:10 AM
Posted 29 August 2012 - 02:57 PM
vipes2010, on 29 August 2012 - 03:10 AM, said:
Posted 30 August 2012 - 11:49 PM
net.netInit("back")
Posted 01 September 2012 - 11:07 AM
Posted 01 September 2012 - 07:30 PM
Wolvan, on 01 September 2012 - 11:07 AM, said:
Posted 10 October 2012 - 06:02 PM
Posted 11 October 2012 - 12:16 AM
local connections = {}
while true do
--wait for input from client connections on socket 21.
conn, messType, message = connection.listen(21)
--okay, we have a packet, see if the connection is one we already
--know about.
if connections[conn] and connections[conn].status == "open" then
--we can use additional entries in our 'connections' table
--(which is internal to the server app) to store information
--about client state, among other things.
if messType == "data" then
--handle client input here; use the connection number in
--'conn' to send data back.
print(message)
connection.send(conn, "done", "OK")
--break packet tells the client we are done transmitting
--and are ready for the next command. This is optional. Some
--types of servers wouldn't need to use this, e.g. a chat
--server.
elseif messType == "close" then
--client has closed the connection, so let's close out
--the connection information.
connection.close(conn, disconnect, true)
connections[conn].status = "closed"
connections[conn].name = nil
elseif messType == "instruction" then
--these are local instructions. Often unused.
if message == "stop" then
return true
end
end
elseif messType == "query" then
--a client wants to open a connection
if connections[conn] then
--already have an entry for that connection number,
--reset the information
connections[conn].status = open
connections[conn].name = connection.name(conn)
else
--no entry for this connection number, set up a new
--entry.
local connect = {}
connect.status = "open"
connect.name = connection.name(conn)
table.insert(connections, conn, connect)
end
--either way we set up the connection, let the client know
--it was successful.
connection.send(conn, "response", "ok")
end
end
Posted 11 October 2012 - 10:45 AM
Posted 11 October 2012 - 04:57 PM
Namarius, on 11 October 2012 - 10:45 AM, said:
Posted 11 October 2012 - 05:26 PM
Posted 12 October 2012 - 01:08 AM
robhol, on 11 October 2012 - 05:26 PM, said:
local connections = {}
while true do
--wait for input from client connections on socket 21.
conn, messType, message = connection.listen(21)
--okay, we have a packet, see if the connection is one we already
--know about.
if connections[conn] and connections[conn].status == "open" then
--we can use additional entries in our 'connections' table
--(which is internal to the server app) to store information
--about client state, among other things.
if messType == "data" then
--handle client input here; use the connection number in
--'conn' to send data back.
print(message)
connection.send(conn, "done", "OK")
--break packet tells the client we are done transmitting
--and are ready for the next command. This is optional. Some
--types of servers wouldn't need to use this, e.g. a chat
--server.
elseif messType == "close" then
--client has closed the connection, so let's close out
--the connection information.
connection.close(conn, disconnect, true)
connections[conn].status = "closed"
connections[conn].name = nil
elseif messType == "instruction" then
--these are local instructions. Often unused.
if message == "stop" then
return true
end
end
elseif messType == "query" then
--a client wants to open a connection
if connections[conn] then
--already have an entry for that connection number,
--reset the information
connections[conn].status = open
connections[conn].name = connection.name(conn)
else
--no entry for this connection number, set up a new
--entry.
local connect = {}
connect.status = "open"
connect.name = connection.name(conn)
table.insert(connections, conn, connect)
end
--either way we set up the connection, let the client know
--it was successful.
connection.send(conn, "response", "ok")
end
end
Posted 12 October 2012 - 06:32 AM
0 members, 1 guests, 0 anonymous users