Thursday, April 5, 2007

Networking Part 3

Well, I've been coding away and trying to get a combined client/server GUI that can act as both a server or a client. When I set myself a goal I always achieve it and this is no exception. Below is a picture of the GUI so far.

The GUI can perform these actions so far:

- Detect Incoming Client Connection
- Detect Client Disconnection
- Simple Chat (between multiple clients)
- Disconnect all clients when the server goes down and provide an appropriate message.
- Trigger an event (This needs to be extended upon to fit in with the actual game engine)

Now, in the picture you might be able to see that when the Server's connection is terminated, the client is terminated afterwards. This is because when a host (player) starts up the server they then join their server as a client at the same time. Why? Because the server is only setup to deal with incoming clients and sending to and receiving data from clients. By trying to implement the client functionalities into the server I came across complications with sending the incoming data back out to the other clients. Hmmm its hard to explain the problem I was having because its very complex when your working with threads. If I think of a good way to break it down and explain it I'll write it up on here.

So far I feel like I have achieved a lot, and learnt a lot more about networking and Java sockets. I'm feeling confident in my ability to pull this off, only time will tell though.

No comments: