Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can I receive the progress during sending the file? #16

Open
ZsIsMe opened this issue Apr 8, 2015 · 3 comments
Open

can I receive the progress during sending the file? #16

ZsIsMe opened this issue Apr 8, 2015 · 3 comments

Comments

@ZsIsMe
Copy link

ZsIsMe commented Apr 8, 2015

Sir, more a question,can I receive the progress during sending the file?
I mean ,can I get "0.6M/2.0M" ,"1.2M/2.0M","1.8M/2.0M","Finish" such information during sending the file?
I had read the XMPPIncomingFileTransfer.h and /XMPPFramework/Extensions/XEP-0065 XEP-0066,but
can't find any useful information...
Thanks

@jonstaff
Copy link
Member

jonstaff commented Apr 8, 2015

If you're using IBB, this should be pretty simple—just compare the number of bytes received with the total number of bytes in the transfer.

For SOCKS5, you'll have to devise another way. It's not included by default.

@ZsIsMe
Copy link
Author

ZsIsMe commented Apr 8, 2015

If I set disableSOCKS5 = YES,then I set to use IBB.
"just compare the number of bytes received with the total number of bytes in the transfer.",
but how can I received the total number of bytes and the total number of bytes during the transfer?

  • (void)xmppIncomingFileTransfer:(XMPPIncomingFileTransfer *)sender
    didSucceedWithData:(NSData *)data
    named:(NSString *)name
  • (void)xmppIncomingFileTransfer:(XMPPIncomingFileTransfer *)sender
    didFailWithError:(NSError *)error
  • (void)xmppIncomingFileTransfer:(XMPPIncomingFileTransfer *)sender
    didReceiveSIOffer:(XMPPIQ *)offer

this 3 method only be called when the action begin/succeeded/fail ,but not being called during the progress.

@ZsIsMe
Copy link
Author

ZsIsMe commented Apr 8, 2015

Sir,I found part of the answer:
the XMPPIncomingFileTransfer can call the delegate method in GCDAsyncSocketDelegate:

-(void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag

I add all the partialLength together then I get the value almost equal to the file's data length.(Both work for IBB and Socket5),

when sending the file,the value is gradually equal to the file's data length ,then I know the progress.
But the question is,
when I receive the file, I only know how much I have accepted, no idea the whole file's data length,
then I don't know how much data I havn;t received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants