Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    Looks like it should work.
  2. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
  3. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
  4. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
  5. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    import java.io.*;
    import java.net.*;

    public class SimpleClient {
    Socket socket;
    String fileName;
    int fileBytes;

    public void go() {
    try {
  6. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
  7. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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.
  8. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
  9. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
  10. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    Did you make the changes I suggested? What was printed out?
  11. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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
    ...
  12. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    Completely or just a few bytes?

    Can you make a small executable program that demos the problem that we can test with?
  13. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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
  14. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    Are you trying to send binary data as text/Strings? Doesn't work.
  15. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    Write a simple short program, compile and execute it to test.
    Let us know what happens.
  16. [SOLVED] Re: Can't Get Network I/O To Write And Read Properly...

    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...
Results 1 to 16 of 16