File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Reading Socket!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Reading Socket!!" Watch "Reading Socket!!" New topic

Reading Socket!!

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
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


Joel McNary

Joined: Aug 20, 2001
Posts: 1824

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.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: Reading Socket!!
jQuery in Action, 3rd edition