This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading Socket!!  RSS feed

 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,

I get stuck up in the following code. I am trying to do the following:

1. Making a connection
2. Writing something on it.
3. Reading from the socket.

Surprisingly while trying to read from the socket it fails toread anything in first attempt. Even trying available() method returns 00. but a subsequent reading always gives me the data back available on the socket. Though even in this attempt the available() method returns 0.

Why it is showing such a behaviour? Am I doing something wrong? Can you pl help me

regards,
Arun

 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems a bit beyond the beginner stage, so I'm moving it to the I/O and Streams forum. Mayhaps you'll get a better answer there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!