Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hamish Jones   on Jun 12 In Java Category.

  
Question Answered By: Abana Cohen   on Jun 12

don't use the readline() method in your case. This method only returns
to the caller when an end-of-line character has been read. This
presumes that you're reading a text file but most probably won't help
with any other kind of file (or communication channel in general).
Use the read() methods associated with single bytes or an array of
bytes if you know how many bytes you have to read exactly. But in
order to give some more detailed advice you would first have to tell
us more about your project and what you've done so far.

The easiest thing for you (in my opinion) is to browse the Javadoc of
java.io and/or java.net packages and all their methods. Then you'll
get the quickest survey of what can be done how and with what methods.
For example, usually I open a TCP/IP channel with the classes Socket
and ServerSocket; afterwards I retrieve the input stream and output
stream associated with that socket  (using methods getInputStream() and
getOutputStream() of class Socket), and then use the read() and
write() methods of these streams to exchange data with sockets.

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

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


Tagged: