Jump to content

Send Image using forge packets?


DarkGuardsman

Recommended Posts

Is it possible to send an image using forge packet system. I have managed to download images using buffer streams and such using urls. However the only way i can get files download from my server mod is using ftp connection which need a password and username. problem with this is not every server owner will want to share there ftp password and username with every client. So i had an idea why not just send the image from the server instead of downloading from the server. Since forge has a built in system for passing data to the client why not see if i could use that. Is it even possible or do i have to make my own system for doing it.

Link to comment
Share on other sites

Why don't you send a reference to the image for example a URL instead? Takes less memory.

Yes but i'm trying to have a folder server side that contains custom Guard texture for each server instance. I can get them to download using a url just fine but i don't want to have servers need to host there images else where. In other word make it simple by having a folder that the mod read the image from and sends it too the client to be saved. Though i'm not sure how to do this now, i though about using forge packet system but how do i tell the client which image i'm sending it? Should i make the client request the image then the server send it to the client. The client expecting it would save it as the correct image?

Link to comment
Share on other sites

  • 4 weeks later...

I think Minecraft already does something like this when it downloads player skins -- you might like to look into how it does that.

 

In any case, it's certainly possible -- you can put whatever data you want in a packet, including image data. I wouldn't try to download megabyte-sized files this way, since that might put rather a lot of load on the server, but small images should be fine.

 

As for the protocol, having the client request it from the server is probably best, especially if you're cacheing it in a local disk file, since the client can skip it if it already has the image.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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