I am trying to write a simple networked chat program in Java. I have almost no networking experience. I was wondering what resources I should begin looking at (beside here of course).
Sticking with the core Java API would be best for now.
Java is the first programming language designed from the ground up with networking in mind. As the global Internet continues to grow, Java is uniquely suited to build the next generation of network applications.
Through the classes in java.net , Java programs can use TCP or UDP to communicate over the Internet. The URL , URLConnection , Socket , and ServerSocket classes all use TCP to communicate over the network. The DatagramPacket , DatagramSocket , and MulticastSocket classes are for use with UDP.
The java.net package supports two protocols, TCP: Transmission Control Protocol provides reliable communication between the sender and receiver. TCP is used along with the Internet Protocol referred as TCP/IP.
Protocol is a term used by particular object-oriented programming languages with a variety of specific meanings, which other languages may term interface or trait. When used otherwise, "protocol" is akin to a communication protocol, indicating the chain of interactions between the caller and the object.
I found a great tutorial into networking and java from sun's own website: http://download.oracle.com/javase/tutorial/networking/TOC.html
The socket section even has you write a mini client / server chat demo.
I recommend you to first learn networking. If you have time read the Tanenbaum book, the greatest reference in networking. If you want a quick leard, here is a road map:
Then go with Java: Socket, ServerSocket, DatagramSocket, RMI, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With