Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Help on socket

  Asked By: Lamberta    Date: May 08    Category: Java    Views: 557
  

i'm trying to develop an application using sockets.and i am
having difficulty in receiving the data from the client.i am using
BufferedReader for receiving data from the client and Dataoutput for
sending data to the client. my problem is, i can only receive the
data from the client when the client disconnected(usually timed
out). so i cannot send a reply to the client. by the way, the client
i am refering to is device(palm pilot) using gprs connection. any
suggestion?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Elaine Stevens     Answered On: May 08

As I understood you are using J2SE on server side and MIDP on
client, correct me if I miss. When you use the BufferedReader to
reading socket  stream you can read text data  from client  through
method .readLine() This method returns data from current position
in stream to nearest \n character. If stream data has no such
character reader will wait for this from stream. So your problem
can be in that client does not send  line-termination characters.
Also you can check reader for stream is ready to be read by ready()
method.

 
Didn't find what you were looking for? Find more on Help on socket Or get search suggestion and latest updates.




Tagged: