• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trying to use NSStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to use NSStream


  • Subject: Trying to use NSStream
  • From: Development <email@hidden>
  • Date: Sat, 12 Jan 2008 16:24:15 -0700

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?

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Trying to use NSStream
      • From: Keary Suska <email@hidden>
    • Re: Trying to use NSStream
      • From: Development <email@hidden>
  • Prev by Date: Are sheets broken in Leopard or I am doing something very wrong?
  • Next by Date: Re: Are sheets broken in Leopard or I am doing something very wrong?
  • Previous by thread: Re: Are sheets broken in Leopard or I am doing something very wrong?
  • Next by thread: Re: Trying to use NSStream
  • Index(es):
    • Date
    • Thread