Wednesday, April 4, 2007


So I've moved on to the networking side of Java now, I haven't done much with sockets and networking in any language before so this is all pretty new, though I do understand how the internet works. I started reading some information about sockets in one of the many e-books I got recently, what I've read so far is but isn't that helpful most of what I'm reading is about threading and input/output streams for sockets. What I've gathered so far, is if you create a socket that successfully connects to a server it sets up a dedicated link between the computers and any information/packets sent between them use TCP/IP which is a reliable way of communication. TCP was layered on top of IP to give each end of a connection the ability to acknowledge receipt of IP packets and request retransmission of lost or corrupted packets. Furthermore, TCP allows the packets to be put back together on the receiving end in the same order they were sent.

Some of the books I've been looking at include:

Java Network Programming, 3rd Edition - By Elliotte Rusty Harold
Java Network Programming, 2nd Edition - By Elliotte Rusty Harold

I also did some Google searches to get more of a basic tutorial on how to build a client/server network setup, some of the sites I notably bookmarked are below.

Writing Server Side Sockets
Reading and Writing to a Socket
Socket Programming
Multithreaded Chat System

Looking at the article "Mutlithreaded Chat System" it looked to have all of the characteristics I am looking for in developing this network. So I compiled and ran the code to get a better understanding of how it works. I discovered that for each connection made to the server, it starts a new thread that handles all the input coming from a client and then distributes the input back out to the rest of the clients. That example doesn't actually have any client, it gets the user to use telnet instead, so this means I'll have to write up the code for the GUI. Writing the client side is a good thing anyway, it means I get to play with the code and really start to understand it.

I'll post more soon.

No comments: