When I connect to a remote server using socket and read through the stream, I want to know the data type I am currently reading so that I can deal with them correspondingly. How can know the type of data I am reading? Could anyone please help?
Please read and follow the Naming Policy. It can benefit you, read Book Promotions. Unless you have first hand knowledge of the data types the server is sending and in what order, you can't. After all the word Help on the stream when read in as a byte array and converted to a string gives you 'Help' when read in as a 4 byte int gives you 1214606448. Hope this helps
[This message has been edited by Carl Trusiak (edited January 18, 2001).]
Thanks Carl, I am using readLine() method in BufferedReader class, is a whole .gif file read in a whole line? I only want to deal with text/html files. How can I discriminate them from other file types, like .jpeg, .class and so? Can I make a decision after read a few characters? How could I change my user name? reregister?
Joined: Jun 13, 2000
Yes, reregister The software will allow you to change everything but your user name. Your using the wrong Input method. BufferedReader reads in things as Unicode and this will corrupt the data in your file. You need to use BufferedInputStream.
Hope this helps [This message has been edited by Carl Trusiak (edited January 18, 2001).] [This message has been edited by Carl Trusiak (edited January 18, 2001).]