[MISC] CraftProxy 0.2.0 - Reduce bandwidth use by caching chunk data [1.6]

Discussion in 'Archived: Plugin Releases' started by Raphfrk, May 1, 2011.

  1. Offline


    CraftProxy - Reduce bandwidth use by caching chunk data
    Version: 0.2.0


    This plugin and local client allows chunk data to be cached locally by players. This reduces the bandwidth required for hosting the server. It also helps users who are on slower connections.

    I am not sure what the status of this system is. It doesn't count as a plugin, since it has 2 parts.

    Even when running the plugin, players who don't use the client proxy can still connect. However, they will use the full bandwidth.

    The system can reduce bandwidth by 70-90% (after the 2nd login).



    Add the plugin file to the plugins folder


    Start minecraft client and login
    Double click on the client jar file
    Enter login details
    Enter the server location/port in the GUI
    Press start on the GUI
    Connect to localhost on the minecraft client

    Stable Builds

    None yet

    Dev Builds

    Warning: These may not be stable


    Had it get the compress/decompression gain backwards.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
    Jushy, Martin1704, Nathan C and 24 others like this.
  2. Offline


    Ok, I have removed all the code related to bandwidth limiter. However, it should be more stable now.
  3. Offline



    I'm trying to get this to work with Transporter, so I can have several servers running on the same machine, could you help me out ? :)
    Basically I'm trying to get it so that users have to use the Transporter portals, and can't just connect to one server or the other.
    The main thing is I get "Warning: Players will be reconnected to default server regardless of the server they last connected to", wether I start it as a plugin or a stand-alone .jar.

    Edit : I seem to have gotten it almost work, but I'm getting this error when I go through a portal :/
    [11:04:36 PM] (Pr4w): Closed connection to client
    [11:04:33 PM] (Pr4w): Attempting to connect to: localhost:22000
    [11:04:33 PM] (Pr4w): Connection successful
    [11:04:33 PM] (Pr4w): Connecting using proxy to server connection format
    [11:04:34 PM] (Pr4w): Server login successful
    [11:04:36 PM] (Pr4w): EOF reached
    [11:04:36 PM] (Pr4w): Unable to flush output stream
    [11:04:36 PM] (Pr4w): Closed connection to server
    [11:04:36 PM] (Pr4w): Closed connection to client
  4. Offline

    Patrick Wrobel

    hey is this safe to use as is with the memory leak? i tend to restart my server every few hours currently to maintain good performance but dont really want to do more than that. my server typically houses me (connected locally) and 2 or 3 friends connected via Internet.

    also whats the CPU usage like for the proxy client?

    lastly, if i do decide to use this, i can connect to my server locally without the proxy client, right?
  5. Offline


    I assume you added a reconnect file?

    Have you set all of your servers to offline mode? If you are using the proxy to do reconnecting, the proxy has to handle authentication.

    I don't think the issue happens more than once every few hours.

    You could help solve it by capturing a heap dump :).

    Should be reasonably low, but it does have to decompress and recompress the data so there is some CPU load.

    Yes, just connect directly to server using the standard port. However, you need to use the proxy to have auto-teleporting.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
  6. Offline


    And it works ! Thank you very much :)
  7. Offline


    Just make sure you don't forward the ports for those servers to the outside world.
  8. Offline


    Yep, that's the main reason I'm using the proxy. Both servers are listening on :)
  9. Offline


    Aha, removing the bandwidth limiter seems to have fixed the hangs I was having too. Seems to work fine now, including with modded client and server. :)

    Ok, I retract that statement, it mostly-but-not-completely works.

    Some mods are perfectly fine, others (like BuildCraft) crash the client.
  10. Offline


    These are client mods?
  11. Offline


    Client and server, need both halves for it to work properly.
    (Well, multiplayer, at least. Single player, obviously, only needs client. :))

    The client is crashing while handling a packet 230 though, so obviously something in my code for that isn't quite right... I'm thinking in the string array handler since it seems to work fine for mods only sending integer arrays, but not sure what I got wrong.
  12. Offline


    Ahh right, I was wondering if it was another mod.

    It's on my to-do list. The proxy should print out an error when it loses track of the packets. It is basically the 80 bytes before and after the first illegal ID.
  13. Offline


    Yeah, that's the weird part, the proxy keeps on going like nothing went wrong... just the client falls down and goes boom.
  14. Offline


    So, to replicate the issue I need to use "BuildCraft"?
  15. Offline


    There may be others which have the same problem, but BuildCraft is one I've run into which does.
    Client and SMP server mods (scroll down to "Install Information" section for links to dependencies), Bukkit server mod (dependencies also available in that thread).

    Probably also needs the config changed to use pneumatic power instead of redstone.
    Most of it works alright, the crash I found was connecting to a world which already has a running engine in it... in my case it was a steam engine attached to a quarry (because quarries are the most buggy things), but the crash was in the engine code so it may happen with other things as well.
  16. Offline


    That first link is to v1 of the server, that's what was causing problems for me.

    Hmm, actually, is it v1 for both?

    Can you just give direct links to the files, while I am willing to go to some effort, I have no desire to go hunting for the various files.
  17. Offline


  18. Offline


    Great. I can't see why that would be causing a memory leak (for Craft Proxy at least)

    Btw, are you seeing any warnings like this in the Craft Proxy log:

    [15:38:58] (raphfrk): Chunk update packet sent for unallocated chunk 63, 3 adding fake init packet
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
  19. Offline


    Sure thing, I mostly provided links to the threads because they also have other information.

    For client: ModLoader, <Edit by Moderator: Redacted mediafire url> MinecraftForge, and BuildCraft Core, Builders, Energy, Factory and Transport (not sure why he couldn't provide those 5 parts in 1 download...)

    For a Bukkit server: Bukkit 1060 (which I assume you already have), <Edit by Moderator: Redacted mediafire url>
    Last edited by a moderator: May 25, 2017
  20. Offline


    Officially confirmed:

    No memory leak with
    Craftbukkit 1064
    Craftproxy 116

  21. Offline


    Last edited by a moderator: Dec 14, 2016
  22. Offline


    Is this implemented into spout? Or does spout have a similar thing? I can't seem to get craftproxy to work. I'll attempt it again. maybe it is because i'm local what I'm testing it.
  23. Offline


    Hmm... if the install was done correctly (open minecraft.jar in 7Zip/WinRar/etc, drag files from inside .zip files to inside root of .jar file, delete META-INF directory) that should be enough...

    Nope, just tried it here, and you're right, it doesn't work. Will edit again when I figure out why. :)

    Edit 2:
    Okay. Looks like it's just a case of "simpler is not always better" and it needs at least something installed to initialize it. I used IndustrialCraft in testing (Client, <Edit by Moderator: Redacted mediafire url> because, although it's a fairly major mod, it has no prereqs to hunt down and install.
    It does work fine with the patch to add packet 230 to CraftProxy I posted a couple of pages back, at least as far as I've tested.
    Last edited by a moderator: May 25, 2017
  24. Offline


    Is there any way to stop the proxy from a command in a .bat file? I don't think there's a command in a .bat to type something in another program, and it has to be done manually, but I would like to be surprised.
  25. Offline


    Dunno, there might be something like a java to java process linkup.
  26. Offline


    I managed to do it by using a program meant to automaticly fill in passwords called KeePass. It's kind of an ugly solution, but it works. :)
  27. Offline


    So you can point it at a process and say "type: end" ?
  28. Offline


    Well, you can point it at a window (I was able to configure a windowname for craftproxy using the start command), and then say the password to fill in there is end, and say the format it has to use is {PASSWORD}{ENTER}. It isn't really stable though, and also slow, but it's something. The bat script now automatically starts craftproxy and spout, and stops craftproxy when I close Spout.

    Next thing for me to do is a .sh of it, but I can't find the call or start /wait command there. So if anyone here's experienced with that, please let me know which command that is if it exists.

    Edit: For some stupid reason, the craftproxy window has to be in the foreground when KeePass tries to type thing in it... trying to build a .exe that is able to drag it to the foreground. Programming is hard, lol.

    Edit 2: I found a program to do it, everything works great now, except that's closing still very slow. If anyone's interested in it, let me now, although I don't think anyone is. That was me trying to program things for today (nobody cares, I know xD).
  29. Offline


    Add ModloaderMP support please? (Packet 230):
    Edit: Found the patch someone posted 2 pages ago, seems to work.

    I also added CraftProxy directly into the client. It was pretty easy, I've added instructions in the spoiler tag.
    Show Spoiler
    Have a clean MCP source available, add all the source files from CraftProxy into it except for CraftProxyLiter.java (the plugin), add this file to net/minecraft/src as CraftProxy.java:
    Add this below public String mpPassParameter; in Session.java:
    And add this to GuiMultiplayer.java below mc.gameSettings.saveOptions();:
    That will make it try to connect to every server using CraftProxy, which may not be what people want, but someone more skilled at modding than me could make it a setting when joining a server. If using my mod and you try to connect to a non-CraftProxy server you'll get disconnected. You could always add a check for the port number and if it's 20000 assume it's a CraftProxy server.

    the craftProxy variable could be stored pretty much anywhere, but I didn't want to modify Minecraft.java because a lot of other mods do so I just modified Session.java instead.
  30. Offline


    Heya, Jdbye, as a non-developer, how in the heck would I go implementing that patch?

  31. Offline


    Ok, well, you didn't ask me, but will try anyhow. ;)

    It somewhat depends on your environment... it's the most straightforward on Linux, and since a lot of servers run on that, that's the steps I'll be giving. But Windows should be pretty similar, just a little harder to find the right programs and a little more confused about paths.
    1. Install git and some version of JDK (which you should really have anyhow, the JDK's "server" virtual machine is lot faster than normal JVM "client" one)
    2. Get a copy of the CraftProxy source with "git clone git://github.com/Raphfrk/CraftProxyLiter.git"
    3. Copy the text from the patch into a text file, call it whatever you want, but something like "packet230.patch" is traditional. ;)
    4. Go into the directory git created, and apply the patch with something like "git apply packet230.patch"
    5. Make a new directory to put compiled files, lets say "mkdir class"
    6. Compile it with something like "javac -cp craftbukkit-0.0.1-SNAPSHOT.jar -d class com/raphfrk/*/*.java"
    7. Package the compiled files as a .jar with "jar cvfm CraftProxyLiter.jar manifest.txt -C class ."
    8. If you want to use it as a Bukkit plugin too, add the plugin.yml, either manually with some graphical archive program, or with "jar uvf CraftProxyLiter.jar plugin.yml"
    If you run into any problems, in particular if step 4 doesn't work right, please post what happens. :)

Share This Page