discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

socket losing data


From: Marko Riedel
Subject: socket losing data
Date: Fri, 2 May 2008 17:40:37 +0200 (CEST)

Hi there,

I have a bidirectional socket which I create like so:

    NSFileHandle *fileHandle =
      [NSFileHandle fileHandleAsClientAtAddress:[remote address]
                    service:[fexport stringValue]
                    protocol:@"tcp"];

I use this to upload data to a server in chunks of 1MB size. The problem
is, the last chunk, which may be less than 1Mb, does not always get there.

I don't know what method to use to flush this socket. The upload (to a
webserver, which I didn't write) looks like this:

      while([(dchunk = [sendFile readDataOfLength:CHUNK]) length]>0){
        [fileHandle writeData:dchunk];
        written += [dchunk length];

        [progind setPercent:
            ((float)100.0)*(float)((double)written/(double)rest)];
        [progind display];
    };

    NSLog(@"%lld byte(s) written", written);

How do I ensure that all the data get there? I talked to the programmer
who wrote the webserver and his logs show a timeout on the socket before
all the data have arrived, as determined by a Content-Length header.

Best regards,

Marko Riedel


+-------------------------------------------------------------+
| Marko Riedel, EDV Neue Arbeit gGmbH, markoriedelde@yahoo.de |
| http://www.geocities.com/markoriedelde/index.html           |
+-------------------------------------------------------------+


      Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go




reply via email to

[Prev in Thread] Current Thread [Next in Thread]