
July 18th, 2003, 03:02 PM
|
|
Junior Member
|
|
Join Date: Jan 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Chat huh...
I'm new to Java but I do know that making a simple chat is quite simple... in C++ I used winsock and it goes something like this.
First you initialize winsock, declare a socket, send and recv messages with the server.
With most every networking libs I've seen it goes something like this int Send(socket, buffer, bufferlength) ... with my chat application the buffer is a simple char array. In a chat you need to come up with some type of protocol. The simplest would be something like char Buffer[] = "<MSGID> <PARAMETERS> <MESSAGE>"; for a simple chat message to a room it could be.... "PRIVMSG ROOMNAME Hi how are you?"; then the server should be able to split that into parts. I'm pretty sure that it would be somewhat the same in java, after all this is concept not syntax. You might want to open a raw connection to an irc room and see how the IRC protocol works if you have trouble with protocol.
Also... you need to decide if you will be using blocking or non-blocking sockets....
Blocking: When the program is running and runs into a Send() or Recv() function it stops until something is sent or recevied.... this can be very bad troublesome.
Non-Blocking: The Send() and Recv() functions (particularly the Recv() ) run in a seprate thread so that the program can continue execution while it waits for a message to be received.
I hope this helps.
-Jaye
|