Skip navigation.
 
mlTrying to use NSStream
FROM : Development
DATE : Sun Jan 13 00:24:15 2008

Hmm.. I am quite lost here and cannot seem to find any information. I 
am trying to use NSStream to connect to and communicate with a mail 
server. The connection actually seems ok and I get the +OK hello 
message from the server then all further communications fail.

When I try to send a request to the serve I get no data back... 
However I have no trouble at all communicating with http servers. Any 
way this is my write code:

- (IBAction)sendText:(NSString*)stringToSend
{
   NSLog(@"StringToSend %@",stringToSend);
   [rawData insertText:[NSString stringWithFormat:@"\n%@",stringToSend]];
   [textField setStringValue:@""];
    NSData * dataToSend = [stringToSend 
dataUsingEncoding:NSISOLatin1StringEncoding];
    if (ostream) {
        int remainingToWrite = [dataToSend length];
        void * marker = (void *)[dataToSend bytes];
        while (0 < remainingToWrite) {
            int actuallyWritten = 0;
            actuallyWritten = [ostream write:marker 
maxLength:remainingToWrite];
            remainingToWrite -= actuallyWritten;
            marker += actuallyWritten;
        }
    }
}

After I send a block of data and get nothing back. The input stream 
has no data available and the event sent to the controller is 
NSStreamEventHasSpaceAvailable along with the outputstream for the 
stream variable. I have made sure that I append \n to the end of each 
string I send, I have also tried \r instead but nothing seems to help. 
Any ideas?

Related mailsAuthorDate
mlTrying to use NSStream Development Jan 13, 00:24
mlRe: Trying to use NSStream Development Jan 13, 02:16
mlRe: Trying to use NSStream Andrew Farmer Jan 13, 02:36
mlRe: Trying to use NSStream Brady Duga Jan 13, 02:51
mlRe: Trying to use NSStream Keary Suska Jan 13, 18:15
mlRe: Trying to use NSStream Development Jan 13, 20:19
mlRe: Trying to use NSStream -another question Development Jan 13, 23:41
mlRe: Trying to use NSStream -another question Andrew Farmer Jan 14, 00:12
mlRe: Trying to use NSStream Ryan Homer Jan 14, 14:28