This afternoon I’ve been doing some research for my independent study on passing objects on Java sockets. What I need to do is create an application level interface for my chat program to send messages… and in Java, that’s easily done in an object. And passing objects is a little confusing. Fortunately, developer.sun.com is an excellent resource, so I think I’m on the right track.
Right now my chat program passes a string to the server only. What I’m going to do is create an object that stores the users nickname, the type of the message (computed by the client as the message is sent), an option field, and the message itself. If the user just types normally, it will be a public (PUB) message, if they put /msg the message will be private (PRV) and the username that follows will be sent in the option field. The message field is self-explanatory. This object is then passed to the server, which will access its component parts and process the message accordingly.
This is going to be interesting, this is the first real piece of software that I’ve had the control over to design the way I please. It’s pretty scary, and pretty fun. I’ll be sure to keep the blog updated with my progress.
Related Articles
1 user responded in this post