Looks like it should work.
Type: Posts; User: Norm
Looks like it should work.
No, that's way too complicated. The loop I was talking about is about 12 statements total.
It doesn't have any max record size test. It adjusts the start pointer and the length as the data is read...
Here's a way to work out the logic. Say you are going to read a total of 10 bytes.
On the first read you use start=0 and length=10
But you only read 3 bytes into the buffer.
Now compute what the...
The code you just posted looks a mess. You can fix the simple program you gave me to work. Go back and work on that.
For the first pass, don't mix the reading and writing. Just read in all of the...
import java.io.*;
import java.net.*;
public class SimpleClient {
Socket socket;
String fileName;
int fileBytes;
public void go() {
try {
The purpose of the changes: get the number of bytes read and print them out is to provide debug information about how your program is executing.
I was talking about the test program which I have a...
It only printed that one line? The println should be inside of the loop.
Could you post the code for the loop where the client reads the data sent from the server.
I suggested: System.out.println("C nbrRd=" + nbrRd);
And you say it printed out: 65536
I don't see how that is possible. What else did it print out? Wasn't "C nbrRd=" there?
Could you post the...
BTW Nice test program.
However I prefer one that works automatically without a GUI.
I added this:
public static void main(String[] args) {
File selection = new...
Did you make the changes I suggested? What was printed out?
Your problem is in the read loop on the client. Change and add this to see what happens:
int nbrRd = is.read(bytes); // get count of bytes read this call
...
Completely or just a few bytes?
Can you make a small executable program that demos the problem that we can test with?
Why did you ask this?
I've lost track of your current problem. Can you explain?
0xFFFF=65535
That's the limit for 2 unsigned bytes
Are you trying to send binary data as text/Strings? Doesn't work.
Write a simple short program, compile and execute it to test.
Let us know what happens.
I can't understand how code you've written can do that.
If you don't read the file, then it won't be able to send it.
You must have a logic problem.
I see zero comments in your code so I can't...