• Get every networked string?
    4 replies, posted
Is it possible to get every string that's being networked? Trying to check what the cause of lag is on my development server, would be really beneficial to get everything being sent back and forth, I've had a look through the wiki but not sure how I could get a list of them.
loop through [URL="http://wiki.garrysmod.com/page/util/NetworkIDToString"]util.NetworkIDToString[/URL]
[QUOTE=Kevlon;51800950]loop through [URL="http://wiki.garrysmod.com/page/util/NetworkIDToString"]util.NetworkIDToString[/URL][/QUOTE] I think he meant network traffic, or network traffic that are strings specifically. You can override the net functions and use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/debug/Trace]debug.Trace[/url] inside of them to see the source of the message. Make sure you still call the original net function inside of your override as to not break anything.
I'd recommend you to use FProfiler, it'll allow you to debug exactly this: [url]https://facepunch.com/showthread.php?t=1517058[/url] And yes, while not a great idea, you can in-fact override net.Incoming to log networked traffic to add every message sent (as they are being sent. Increment a table etc) Example: [lua] --maybe a better idea to cache the function and call from there instead of overriding it? idk lol function net.Incoming( len, client ) local i = net.ReadHeader() local strName = util.NetworkIDToString( i ) if not strName then return end local func = net.Receivers[ strName:lower() ] if not func then return end len = len - 16 --LOGGING CODE HERE --print( "Networked message '" .. strName .. "' has been sent by: '" .. client:Nick() .. "'" ) func( len, client ) end [/lua]
Well if you want to get EVERY NETWORKED STRING like your TITLE ASKS then you can run [code] local i = 1 while true do local a = util.NetworkIDToString(i) if not a then break end print(a) i = i + 1 end [/code] (Untested, written in forums)
Sorry, you need to Log In to post a reply to this thread.