Re: Telnet Networking Example
Re: Telnet Networking Example
- Subject: Re: Telnet Networking Example
- From: Jens Alfke <email@hidden>
- Date: Thu, 23 Jul 2009 11:33:44 -0700
On Jul 23, 2009, at 11:24 AM, DerNalia wrote: Since this: - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode sounds like it should do what I want, and NSStreamEvent is an NSUInteger, do I just break up the command char by char, and send it to this method?
No. Read the docs. That's a delegate method, meaning that you implement it, and the stream calls it when something happens. NSStreamEvent is an enumeration; you can look at its definition to see what events you can be notified of, like 'open completed', or 'has bytes available'.
The method you want to call to send data is -[NSOutputStream write:maxLength:].
Look at CocoaEcho, if you haven't already, and examine the methods sendText: and -stream:handleEvent: in EchoClientAppDelegate.m.
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden