I want to make a server that can send patches or the game itself through a file stream, they just need a very small client program. Is there any way to send actual files (like a random .doc or something, for example) through one of Java’s streams, or do I have to somehow make all of it buildable via ObjectOutputStream?
AFAIK you can’t just send the file, you have to read it in from the file and write it out to the socket stream. I’d use NIO instead - that way you can read the file piece by piece into a ByteBuffer and send them straight to the network. It saves copying the data around as you’d do using streams.
Take a look at Blah3’s NIO tutorial at http://www.javagamesfactory.org/views/article?title=NIO%20Networking%20for%20Games
Hey that looks great. Thanks a lot!
That works.
Myself, I’d just use an FTP server and a Java implementtion of ftp.
Or I’d use Webstart and let it take care of all updating for me.
But whichever
Yeah, webstart is of course a better option for what I was specifically asking, but I want to lay the groundwork for a single program that links up to all info and games on our website, as well as keeping track of current available online players for each game. Basically it will be the do-all tool for every one of our games, and people can open it up really quickly to have it automatically check for updates and things. Maybe even some of the smaller games will just be playable straight through the client instead of downloading them at all, although I doubt that.
Thanks guys.
Make sure to check sum your patches, particularly if you intend to implement pause/restart.