Hi everyone. I'm currently troubleshooting my java program,
I'm trying to link 2 working java programs together.
First program, Client and Server would communicate with each other using PrintWriter and BufferedReader. The program will check whether Client has the correct password to access to the server.
When granted access, second portion of the program will run. This program is a file transfer program. It's using BufferedInputStream and BufferedOutputStream to read and write the stream.
I would like to know whether BufferedReader and BufferedInputStream have any conflict with each other? Would there be any problem if i'm using 1 socket to do all this? In future, I will be transfering more than 1 file.
Please advice. Thanks in advance! [ October 10, 2007: Message edited by: Adrian Lee ]
Erm, basically I'm trying to make my client and server program communicate first.
The client will send a password string to the server. The server upon receiving the String, it will check if the client has the correct password. Checking that it's correct, it will proceed to the next step which is the file transfering/downloading part.
I'm just wondering if all this can be done in a single socket without resetting or closing the socket connection?
Some options ... the string is fixed length, the string is followed by a delimiter that can't occur in the string, or we put a length out first. I like to make delimited strings with the delimiter first. Then the reader grabs the first character and scans forward for another one just like it.
HTTP uses a newline after each header and two newlines between the headers and the body.
You might find it simpler to make the header ASCII instead of Unicode strings. Then you can read everything as bytes and interpret them as you like.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi