• usermessage vs. net Library
    14 replies, posted
Hey, I was wondering if it was worth using the net Library just to sent a trigger to the client?
-snip-
I'd go with the net library over user messages if I were you. More functionality and increased efficiency.
Net messages are sent the same frame while usermessages are sent the next frame. Net messages have a limit of 64kb per message whereas usermessage can only send 255 bytes. The Net library can communicate in both directions ( CLIENT > SERVER && SERVER > CLIENT ) whereby usermessages are one direction only ( SERVER > CLIENT ) and people have to rely on hacky methods of allowing the client communicate with the server such as with console commands which can be exploitable or cause fault in logic if it's not ran in order.
[QUOTE=Acecool;44416976]Net messages are sent the same frame while usermessages are sent the next frame. Net messages have a limit of 64kb per message whereas usermessage can only send 255 bytes. The Net library can communicate in both directions ( CLIENT > SERVER && SERVER > CLIENT ) whereby usermessages are one direction only ( SERVER > CLIENT ) and people have to rely on hacky methods of allowing the client communicate with the server such as with console commands which can be exploitable or cause fault in logic if it's not ran in order.[/QUOTE] Aren't net messages faster than commands ?
I don't know; but when we only had usermessages we'd have to rely on concommands for client > server communication. If there was a sequence of them to be used over time / events then it needed to be coded properly so people couldn't just run x command before b.
Net messages are sent, and received in the exact order received; they're also bound by 20kb/sec limitation. If you send a net-message that's 64kb, you'll tie up the net system for ~3 seconds so no other messages can be sent / received. ( at least in my tests with one player )
[QUOTE=ExtReMLapin;44416992]Aren't net messages faster than commands ?[/QUOTE] Tested on a local server with 2 players I found commands to be faster, was using one for swapping voice channels. Although you should still use net messages.
Understood. thanks.
net library is more insecure
[QUOTE=nettsam;44425825]net library is more insecure[/QUOTE] Only if you allow it to be. As long as you don't overly trust the client, you'll be fine.
[QUOTE=nettsam;44425825]net library is more insecure[/QUOTE] If your really worried about that then have a argument check on the server.
Apparently concommands are limited to 512ish bytes of data, excluding the name. So it seems as though they take 2x umsg. I found out by trying to send a screenshot over: [lua]] send_screenshot 1280 768 131.2626953125 KB WARNING: Command too long... ignoring! rcv_screenshot "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9 PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhC Y2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAAR CAMABQADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xABREAACAQIE AgUHBgwDBwMFAAMBAgADEQQSITEFQRMiUWGRBhQyVHGBoRVSk7HB0RYXIzQ1QnKSstLi8DPh 8Qc2U2JzdKMkQ1UlgpSiwiZEdf/EABoBAQEBAQEBAQAAAAAAAAAAAAABAgMEBQb/xAA0EQEA AQIEAwYGAwADAAMBAAAAAQIRAyExQRJRYXGBkaHR8AQTIrHB4RQy8SMzQkNSctL/2gAMAwEA ";[/lua] [lua]] send_screenshot 1280 768 105.2578125 KB WARNING: Command too long... ignoring! xyz "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9 PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhC Y2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAAR CAMABQADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xABREAACAQMC AgUGCQoDBgUFAAMAAQIDBBESIQUxEyJBUZEGFDJUYXEVFjRSgZOhwdEXIzVCcpKxstLiU3Pw BzM2YnSjJENV4fElRIKUomN1wv/EABoBAQEBAQEBAQAAAAAAAAAAAAABAgMEBQb/xAA6EQEA AQIEAwYGAgIBBAICAwAAAQIRAyExQRJRYQRxgZGh8BMiMrHB0RTxQuEzI1JicoLSQ8KSouL/ ";[/lua] I wonder if it uses umsg or how they're implemented.. I'd love to get rid of that 20kb / sec download restriction... If Killburn adds me, I'd like to work on threading, and increasing the download speed limitation if it means rewriting the netcode. I'd also be keen on implemented my net system: [editline]2nd April 2014[/editline] [QUOTE=nettsam;44425825]net library is more insecure[/QUOTE] Never trust user-input -- sanitize input, and if you don't need user-input don't request it. All incoming data on my netsystem is checked against several things including message signing, packets, names, structure, argument count, and more. With message signing secure keys can be sent, and those keys are used to ensure the server authorized those packets. Unknown packets are logged in real-time ( meaning admins are notified and files /player are kept ) and dropped. The beautiful thing is as messages are signed on my system, it's easy to see unauthorized networking messages being sent/received. [editline]2nd April 2014[/editline] [QUOTE=nettsam;44425825]net library is more insecure[/QUOTE] Give us an example? Code is only as secure as the developer makes it.
[QUOTE=nettsam;44425825]net library is more insecure[/QUOTE] How are they more insecure? What exploit is there in net messages that isn't there in concommands/UMSGs?
Sorry, you need to Log In to post a reply to this thread.