Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello everyone. I have a question. I need to transfer binary files from server to client.

 

After studying the Minecraft code, I came to the conclusion that Minecraft downloads custom resourcepack from server via http, there is method ResourcePackRepository#func_148528_a:

 

width=800 height=433http://up42.ru/u/p/2015-01-10_10.55.43.png[/img]

 

So, what can I do? How to send request to server? How to share required files on server?

Thanks and sorry for my language mistakes.

  • Author

I know what I could open connection. But I created this topic because i have no clue how to achieve this.

Question - what kind of files and what sizes/quantity you want to send?

 

I for one am using ingame downloader, player events get cancelled for short time after you log in on server (0 interaction) and in VERY short time everything is downloaded/sychronized using packets.

Obviously I am using CheckSums (hashes).

 

Steps:

Since PlayerLoggedInEvent is launched ONLY on Server i had to 1st send packet from server to client that is literally "start synchronization" msg.

1. Cancel player events.

2. Server -> Client - open GUI on client that shows progress.

3. Client -> Server - get all cached files and generate hashes, put all into NBTTagList and send.

4. Server comapres hashes (note server-side hashes are pre-generated on startup)

5. Server sends series of packets: Lacking files and clear-cache packet containing hashes that are not on server (client removes them from cache).

 

Note: This will work for literally everything you try to upload to client (server too lel), BUT you will need to use some packet-structure for bigger files.  Player event cancellation makes sure he won't die/anything during synchro.

 

P.S - this system is only good for smallr files, more like game data (sending skills, classes, races maybe, some special data like quests (lore, NPC talks)  that you don't want to send everytime player is doing it). For bigger ones I'd suggest custom connection thread - in this caste it's just java stuff (ask google).

 

Edit: Yes you can put binary file into packet (rather packetS) you will just need to read more about it (it's java, i suggest StackOverflow site)

 

Oh and i got confused by "Transfer files to client" and "transfer binary files from client to server." (Described 1st one)

1.7.10 is no longer supported by forge, you are on your own.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.