English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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?

2007-12-15 23:19:14 · 2 answers · asked by Jean-Francois 5 in Computers & Internet Programming & Design

2 answers

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.

2007-12-16 00:24:37 · answer #1 · answered by Floyd P 2 · 0 0

in all probability, the actual layer is abstracted so Java would not extremely care how your community is desperate up. in simple terms bear in mind, UDP would not assure packets will make it to their trip spot, in contrast to TCP.

2016-10-01 22:26:00 · answer #2 · answered by ynez 4 · 0 0

fedest.com, questions and answers