I am constructing a data packet to be sent over NSStream to a server. I am trying to seperate two pieces of data with the a '§' (ascii code 167). This is the way the server is built, so I need to try to stay within those bounds...
unichar asciiChar = 167; //yields @"§"
[self setSepString:[NSString stringWithCharacters:&asciiChar length...
What is the appropriate way of dealing with large text files in Objective-C? Let's say I need to read each line separately and want to treat each line as an NSString. What is the most efficient way of doing this?
One solution is using the NSString method:
+ (id)stringWithContentsOfFile:(NSString *)path
encoding:(NSStringEncoding...
Hi all,
I am using NSStream with SSL property for socket connection. It works fine when I use the local IP address such as 192.168.1.77. But if I use any server like www.xyz.com (it has SecurityLevelTLSv1), it shows an error
error code:-9843, Message:Operation could not be completed. (NSUnknownErrorDomain error -9843.)
Here is my code:
...
Hi, in an iPhone app, I have a socket connection through wifi, and I need to read from inputStream and write to outputStream. The problem is that stream management is event-driven, and I have to wait for event NSStreamEventHasBytesAvailable before reading. So I can't know when reading\writing outside the handleEvent:eventCode delegate me...
I am writing an application that uses NSStream's SSL functions on the iphone. I know that SSL is working because I can directly connect servers using SSL.
I have encountered a problem where protocols that use starttls require me to communicate on the socket with unsecured, send the starttls command and then reuse the same socket for SSL....
Hello,
What is the simpliest approach to copy files from iPhone to iPhone (p2p).
The only way I can come up is this:
Use Bonjour to discover server app (which will advertize itself via
Bonjour)
Use NSStream (or sockets) and then stream data from the file from peer
to peer (read chunk of the file, send chunk of the file and so on un...
I have created one application on iPhone. I build an application that gather accelerometer value and pass this value to c# server in realtime via wifi connection. I use NSStream with IP and port number.
I was working perfectly, but now I realize that it stops after fetch value only 248 lines. I tried to write this value in text file l...
I have created a java server, which takes screenshots, resizes them, and sends them over TCP/IP to my iPhone application. The application then uses NSInputStream to collect the incoming image data, create an NSMutableData instance with the byte buffer, and then create a UIImage object to display on the iPhone. Screenshare, essentially....
I am writing an iPhone application that needs to record audio from the built-in microphone and then send that audio data to a server for processing.
The application uses a socket connection to connect to the server and Audio Queue Services to do the recording. What I am unsure of is when to actually send the data. Audio Queue Services f...
Hi,
I'm new to Cocoa, but not to programming.
Recently I decided I wanted to write a FTP client for Mac, and so I first made it in the language I'm most comfortable in (on Windows), and then moved on to Cocoa when I had the workings of FTP communications down.
My question is (apparently) a bit controversial: How do I establish a read/w...
Upon connecting (to an FTP, at first without SSL) I run:
NSArray *objects = [NSArray arrayWithObjects:@"proxy.ip", [NSNumber numberWithInt:1080], NSStreamSOCKSProxyVersion5, @"user", @"pass", nil];
NSArray *keys = [NSArray arrayWithObjects:NSStreamSOCKSProxyHostKey, NSStreamSOCKSProxyPortKey, NSStreamSOCKSProxyVersionKey, NSStreamSOCKSP...
i'am test my bluetooth device connectting and data read.
but data read callback time is very slow. callback Interval time 100ms..
how can i read callback time fastest?
- (void)openSessionForProtocol
{
NSString *protocolString = @"com.company.datapath";
NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAc...
I am trying to pull some sample data from FreeDB as a proof of concept, but I am having a tough time retrieving all of the data off the incoming stream (I am only getting the last bits for the final query listed here (if handshakeCode = 3)
I think this may be something with the threading on the main runloop, but I am not sure. Odd thing...
Hi
I'm building an iPhoe app with a socket to a PC app , I need to get an image from this PC app.
It's my first time using "CFStreamCreatePairWithSocketToHost".After I establish the socket with "NSOperation" I call
CFStreamClientContext streamContext = {0, self, NULL, NULL, NULL};
BOOL success = CFReadStreamSetClient(myReadStream, kMyNe...
Hi
I'm building a socket , using
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
(CFStringRef) yourHostAsNSString,
yourPortAsInteger,
&myReadStream,
&myWriteStream);
and I s...
I have this consumer class that takes an NSInputStream as argument which will be processed async, and I want to push data that comes from a producer class that requires that it has an NSOutputStream provided as its output source. Now how could I set up a buffering (or transparent) stream that acts as the output stream for the producer, a...
I have an NSInputStream and an NSOutputStream in an iphone app that are connected to a server. I am able to read and write data to the sockets without issue. The problem is that I have a disconnect button, and when I try to call close on either of the streams it hangs the app. I'm guessing that I am trying to call close at the wrong time...
I want to send a large amount of data to a server using NSURLConnection (and NSURLRequest). For this I create a bound pair of NSStreams (using CFStreamCreateBoundPair(...)). Then I pass the input stream to the NSURLRequest (-setHTTPBodyStream:) and schedule the output stream on the current run loop. When the run loop continues, I get the...
I have written a program that connects to a server on a given IP using the NSStream protocol outlined in Apple's stream programming guide. The connection and transfer of data works flawlessly, however if the user specifies the wrong IP and the program attempts to open the streams it results in the program becoming unresponsive.
From wha...
I'm working on transcoding image data from a file to a base64 encoded string and then back to bytes as the file is read using NSStream. I think I'm almost there, but I keep running into EXC_BAD_ACCESS at various points during the conversion.
I'm fairly new to the world of NSStream and buffers so feel free to let me know if I'm taking th...