.InsertNameHere wrote:OK, so I got an example to work when the client sends data to the server, but when I tried to implement the server sending to the client in a game i've been programming, it gives me an error.
I'm looking into this error now, I'll let you know ASAP. I am at a friends house but I'll work on it in a few hours. Sorry for the long wait
**EDIT: I've found your problem, when you're supplying the ip in net:send on the server... it's the clients --ID-- not their ip, the id is a string that is formated like this IP:PORT and deformatted like this local ip, port = id:match( "^(.-):(%d+)$" ) and then passes that to the REAL send command.. and any ids of clients kept by the server is the IP:PORT format, so you need to supply an id. Best solution is to use the net.users and loop through it, and find some sort of indicator. Because you need the port of the client connected to your server. I suggest doing it like this:
1. This will literally send this to every single client connected unless you do the second method
Code: Select all
for CLIENTSID,table in pairs( net.users ) do
Net:send( server_data, "ready", Nil, CLIENTSID)
end
2. This is the "better" alternative, however if you were to give a name to clients you could use the ALTERNATE method
Code: Select all
for CLIENTSID,table in pairs( net.users ) do
i, k = string.find( CLIENTSID, "192.168.1.69" )
if i or k then
Net:send( server_data, "ready", Nil, CLIENTSID )
end
end
-- Alternate
for CLIENTSID,table in pairs( net.users ) do
if table.name == "Nicholas Scott" then
Net:send( server_data, "ready", Nil, CLIENTSID )
end
end
*NOTE: This is were your error is happening
socket:sendto( net:encode( table ), ip, tonumber( port ) ) It's because ip and port are set by local ip, port = id:match( "^(.-):(%d+)$" ) and your string you supply is just an ip it will set the port to nil, hence your error string expected, got nil...
lumaio wrote:I'm having a strange issue where the player will connect but will be immediately timed out and will attempt to reconnect.
(Also, the steam link in the OP is broken)
Looking into this now, do you think you could dropbox the folder of all of your server code, if you don't mind. I would like to see how you run it for debugging, Please and thank you
--Also thanks for informing me of the steam link
calusari wrote:Great library! Been messing around with it and it seems very promising! I love the run remote command feature.
Would like to see a feature to drop packets that are out of order
I'll look into that feature, sounds like a good one. I might receive packets 1, 2, 3 and server/client will drop packet 1, store packet 2 as LAST RECEIVED and keep packet 3 as the latest one. But as of now the end of the net code receives a command and runs it with a table that is also passed, not really any packet/storage, really just a run as it receives kind of thing. May work on this briefly, although I am kind of busy right now, I'll see though
Also thanks for the compliments, I love making my code nice, neat, and if at all possible CHEAT PROOF!! Cause noone likes cheaters
*Cough Cough* DAYZ... H1Z1... CS:GO... CSS... Rocket League... Minecraft( Who cares about minecraft, sorry mc lovers
)... The list goes on and on