List Info

Thread: socket losing data




socket losing data
country flaguser name
Germany
2008-05-02 10:40:37
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, markoriedeldeyahoo.de
|
| htt
p://www.geocities.com/markoriedelde/index.html          
|
+-----------------------------------------------------------
--+


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


_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustepgnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )