Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 12 13 14 15 16 … 18 Next »
Can't send compressed data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
Can't send compressed data
07-08-2015, 12:36 AM, (This post was last modified: 07-08-2015, 01:03 AM by LocInt.)
#1
LocInt Offline
Long gone
****
Posts: 489
Threads: 91
Joined: Aug 2014
Can't send compressed data
Can't send compressed data over using net messages. When I catch the compressed net message it output only "]" and if I try to decompress it well it returns nothing.

If I decompress it right after compressing it the data is correct. This means I haven't sent the data yet using net messages.

Not sure if compress works either due it doesn't decrease the amount of bytes i'm trying to send.

тѕсм.Person8880 hovers the nerf bat over Tetryon damage
Website Find
Reply
07-08-2015, 05:49 PM,
#2
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Can't send compressed data
Compression is not an "I win" button. It has its place for large strings, and that's it. Compressing tiny amounts of data will not provide any significant improvement. Printing will yield nothing useful as there's likely null bytes that stop the output early.

Also, if you want to network compressed data properly, you don't use net.writeString() (as strings are null-terminated and the compressed data is full of null bytes). Instead, you do:
local Size = #CompressedData
net.writeUInt( Size, 32 )
net.writeData( CompressedData, Size )
and to read:
local Size = net.readUInt( 32 )
local Data = net.readData( Size )
Find
Reply
07-08-2015, 06:02 PM, (This post was last modified: 07-08-2015, 06:58 PM by LocInt.)
#3
LocInt Offline
Long gone
****
Posts: 489
Threads: 91
Joined: Aug 2014
RE: Can't send compressed data
(07-08-2015, 05:49 PM)Person8880 Wrote: Compression is not an "I win" button. It has its place for large strings, and that's it. Compressing tiny amounts of data will not provide any significant improvement. Printing will yield nothing useful as there's likely null bytes that stop the output early.

Also, if you want to network compressed data properly, you don't use net.writeString() (as strings are null-terminated and the compressed data is full of null bytes). Instead, you do:
local Size = #CompressedData
net.writeUInt( Size, 32 )
net.writeData( CompressedData, Size )
and to read:
local Size = net.readUInt( 32 )
local Data = net.readData( Size )

Thanks. Seems to work. Good old magic button.

тѕсм.Person8880 hovers the nerf bat over Tetryon damage
Website Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.