Jump to content

  • Log In with Google      Sign In   
  • Create Account


Servers in Java


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Dan Smith   Members   -  Reputation: 122

Like
Likes
Like

Posted 31 October 1999 - 10:43 PM

I was wondering if anyone here has used Visual J++, or any other Java development tool. I just got Visual J++, and I have heard alot about its server capabilities. It seems like a good choice for my server considering one of the major points iny my server is portability.

I was wondering if anyone here has ever written a server in Java.

I'd appreciate if you could give me a list of sites of any sites (Or maybe even some sample code) with information on java, specifically its network and threading functions.


Thanks.

Dan
dans@3dgamedev.com


Sponsor:

#2 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 October 1999 - 10:39 PM

Threading is an integral part of the Java language - I've used it a lot and never encountered any problems (besides those that always come from multithreaded programs )

Networking is not an integral part of the language, but it IS a significant part of the core run-time library. IOW: Any platform that supports Java also supports HTTP and sockets (UDP/TCP) out of the box. In addition, these protocols are SOOO easy to use (a lot simpler than winsock for example).

Java for implementing a server? No reason not to - it won't be much different from implementing it in C (except for the built-in HTTP support, which might be hard to come by for a C app). There's (obviously) a slight performance penalty, but I doubt if it'll ever turn into a problem.

You might want to get a good Java book - they all discuss both threading and networking in detail. (Avoid the big fat 1200 page ones, since they're essentially transcripts of the language spec, stuffed with useless repetition, figures and lousy code samples).

/Niels



#3 Dan Smith   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 October 1999 - 03:16 PM

Well, I dont have any money to get a book at the moment...So I have to rely on the web.

Are there any samples anywhere that demonstrate one? Even just a simple chat server that can echo the message sent to the server, to all the other clients.

I have Learn Java Now, It came with J++ 1.0, yet it doesnt cover threading/networking.

-Dan



#4 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 October 1999 - 03:38 AM

You could try
http://developer.java.sun.com/developer/codesamples/networking/

But there should be tons of network code samples out there.

/Niels


#5 Alastair   Members   -  Reputation: 122

Like
Likes
Like

Posted 31 October 1999 - 05:02 AM

An important thing to consider before implementing a server is how you're clients are going to communicate with it. The simplest way to do it is with the JDK's built in support for TCP/IP and UDP/IP. Then, any client, whether written in C++, Java, Perl or whatever can connect to it.

HOWEVER, if the client lives on the other side of a proxy or a firewall, THIS WON'T WORK! Most proxies and firewalls only allow certain kinds of connections. Most will allow HTTP requests though. To have Java open an HTTP request that will go through firewalls and proxies use something like.

URL url = new URL(...);
url.openConnection();

Check out the URLConnection class to see how to send and receive HTTP requests.

Note that HTTP requests are OK for turn-based games but not realtime!


#6 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 31 October 1999 - 10:43 PM

Actually, wether the game is "real time" or "turn based" is not really the issue.

The key is the amount of latency the game can handle before becomming unplayable. Obviously fast-paced action games such as Quake requires very low ping to be playable. Strategy games (even real-time), though, are much less subject to network latency.

I'll soon open a site with an on-line RTS game that uses HTTP (it's currently in alpha).

/Niels





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS