iphone - Sending large data over bonjour -
i have method sends data through bonjour. problem data limited 1000 kb. know if want send larger data need break in packets.
but raises question of how prevent packets being lost, , ensure packets received receiver.
i not network , ask me change simple method enable larger data transfer.
- (bool)senddata:(nsdata *)data error:(nserror **)error { bool successful = no; if(self.outputstreamhasspace) { nsinteger len = [self.outputstream write:[data bytes] maxlength:[data length]]; if(-1 == len) { // error occured *error = [[nserror alloc] initwithdomain:servererrordomain code:kservernospaceonoutputstream userinfo:[[self.outputstream streamerror] userinfo]]; } else if(0 == len) { // stream has reached capacity *error = [[nserror alloc] initwithdomain:servererrordomain code:kserveroutputstreamreachedcapacity userinfo:[[self.outputstream streamerror] userinfo]]; } else { successful = yes; } } else { *error = [[nserror alloc] initwithdomain:servererrordomain code:kservernospaceonoutputstream userinfo:nil]; } return successful; } thank you.
you're not sending them on 'bonjour', you're sending udp packets multicast address. on networks maximum frame size 1500 bytes. realistically, allowing headers, vlan tags, etc, have 1.3 - 1.4k of data per frame fill. data's going on udp, controlling correct reception , ordering of packets you- it's 1 of drawbacks of not using tcp ;)
Comments
Post a Comment