Saturday, April 17, 2010

Java networking question?

When it comes to Java networking, I'm pretty clueless. I am aware of ServerSocket and Socket.


I can get two instances of my program running, and one be the server and the other the client. The one with the server I run a client off of as well, and the one that is the client I only run an instance of the client. I am able to successfully connect, but the second I try and read information sent from the server, it locks up. This happens when I use the "read()" and "readLine()" methods.


I am trying to get basic networking just to start--a communication between two JTextAreas between two different users. Basically, I'm trying to get a chat program working for the time being, and as soon as that's working, I'm confident I can get the competitive functionality of two games over the network running smoothly.





Do you know of any sources of a basic Server/Client program with two JTextAreas or any good referances to basic Java networking? Or do you have any suggestions to my issue?

Java networking question?
Prior to reading anything in the client, write something out to the server first from the client and see if the server gets it. Let the server send the response after it receives this message from client. Just want to avoid any timing issues. Also, try using the DataInputStream object and its readFully() method to see if you can get data that way.


Merry Christmas.

blue tooth

No comments:

Post a Comment