nsstream

I cannot initialize a NSInputStream

 ̄綄美尐妖づ 提交于 2019-12-23 01:21:13
问题 Please help me, im going insane. I need to create an NSInputStream so i can read a live preview from a camera over wifi. liveViewStream is an NSInputStream -Instance-Variable that is declared in my implementation like so: @implementation MKSonyCamHandler{ NSInputStream *liveViewStream; } liveViewURL is a valid URL that i can open in my browser when i connect to the camera's network (although i dont think that this makes any difference). I have checked that it exists, is not nil and holds the

NSStream Handle Event Giving Status 4

纵然是瞬间 提交于 2019-12-22 10:29:39
问题 I was trying on a TCP connection app, and I am getting a NSStreamEvent "4" on handleEvent. What am I doing wrong? My code is like, -(void) initNetworkCommunication { CFReadStreamRef readStream; CFWriteStreamRef writeStream; CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"localhost", 80, &readStream, &writeStream); inputStream = (__bridge_transfer NSInputStream *)readStream; outputStream = (__bridge_transfer NSOutputStream *)writeStream; [inputStream setDelegate:self]; [outputStream

Locking iPhone disconnects sockets on iOS 5 only

旧街凉风 提交于 2019-12-22 08:30:40
问题 I'm working on a socket based client-server app. When a user running any iDevice on iOS 4, 4.2.1, 4.3.2, etc clicks the lock button while connected to the server, the connection remains alive. However, when I click the lock button on any device running iOS 5, the connection is immediately destroyed and upon returning to the app from the lock screen I am presented with my NSAlertView that is called when the NSStreamEventErrorOccurred method is called. I have had several clients test the app,

SSL Handshake with my certificate by NSStream

大憨熊 提交于 2019-12-22 00:27:42
问题 I'm writing a client for iOS to connect to my server by SSL/TLS. I have decided to use NSStream implementation. And now my project has been stopped due to SSL Handshake, I don't know how handle it with streams and can't find any examples of delegates with it. As I understood the certificate passing should be in NSStreamEventHasSpaceAvailable, but actually I don't understand how. I need to pass my certificate (he is not installed on device). Can someone help me? This code crashes with this:

NSStream don't send all data

走远了吗. 提交于 2019-12-21 17:27:49
问题 My case is quite strange: I practically used the example "SimpleFTPSample" (some small variation of the type [self.networkStream setProperty: (id) kCFBooleanFalse forKey: (NSString *) kCFStreamPropertyFTPAttemptPersistentConnection]; to avoid keeping the connection alive WiFi/3G) to perform transfer operations FTP file but despite not having errors of any kind, your downloaded file is corrupted if you use an ftp site: To resolve this issue, simply add a sleep (3)! This function (sleep) must

Sending UIImage over NSOutputStream [closed]

ε祈祈猫儿з 提交于 2019-12-21 09:13:35
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I'm trying to send an image that user takes to the server. I get the JPEG representation, append that to the string needed to upload the photo, and then

Sending UIImage over NSOutputStream [closed]

孤街醉人 提交于 2019-12-21 09:13:08
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I'm trying to send an image that user takes to the server. I get the JPEG representation, append that to the string needed to upload the photo, and then

Non-responsive stream delegate in Swift

会有一股神秘感。 提交于 2019-12-21 04:30:20
问题 So I was playing around with sockets in Swift and trying to connect the app with my server. I was having the app connect to the IP address of the server and used netcat on the server for testing. During execution, the console output from the app showed it had successfully connected to the server. However, the stream delegate does not seem to be responsive. When I typed into netcat , the app console did not print anything. I have searched for quite a while and found that my implementation is

Is calling read:maxLength: once for every NSStreamEventHasBytesAvailable correct?

这一生的挚爱 提交于 2019-12-20 04:51:39
问题 Sample code from Stream Programming Guide: - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode { switch(eventCode) { case NSStreamEventHasBytesAvailable: { if(!_data) { _data = [[NSMutableData data] retain]; } uint8_t buf[1024]; unsigned int len = 0; len = [(NSInputStream *)stream read:buf maxLength:1024]; if(len) { [_data appendBytes:(const void *)buf length:len]; // bytesRead is an instance variable of type NSNumber. [bytesRead setIntValue:[bytesRead intValue]+len]; }

Is calling read:maxLength: once for every NSStreamEventHasBytesAvailable correct?

[亡魂溺海] 提交于 2019-12-20 04:51:11
问题 Sample code from Stream Programming Guide: - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode { switch(eventCode) { case NSStreamEventHasBytesAvailable: { if(!_data) { _data = [[NSMutableData data] retain]; } uint8_t buf[1024]; unsigned int len = 0; len = [(NSInputStream *)stream read:buf maxLength:1024]; if(len) { [_data appendBytes:(const void *)buf length:len]; // bytesRead is an instance variable of type NSNumber. [bytesRead setIntValue:[bytesRead intValue]+len]; }