Re: Telnet Networking Example
Re: Telnet Networking Example
- Subject: Re: Telnet Networking Example
- From: DerNalia <email@hidden>
- Date: Thu, 23 Jul 2009 17:20:30 -0500
Ah, yes, that is the problem.
My host is nil. So it would make sense for a nil host to return nil
streams.
server_host = @"127.0.0.1";
NSURL *website = [NSURL URLWithString:server_host];
if (!website) {
NSLog(@"%@ is not a valid host address");
return;
}
NSHost *host = [NSHost hostWithName:[website host]];
So, this is how I'm making my host object before invoking getStreams.
website is always valid, so my problem is when I make my NSHost. So I
looked in the documentation to see if there was another way to make an
NSHost.
The host successfully was created with NSHost *host = [NSHost
hostWithAddress:server_host]; and the streams are now no longer nil.
So, now the only problem is sending the right commands to my server.
Thank you so much!
On Jul 23, 2009, at 5:02 PM, Eli Bach wrote:
On Jul 23, 2009, at 2:56 PM, DerNalia wrote:
you're right, oStream isn't pointing to anything, but shouldn't
[NSStream getStreamsToHost:host
port:server_port
inputStream:&iStream
outputStream:&oStream];
take care of that?
I figured that having Garbage Collection on might be the problem,
so I moved all the open stream code to the same method that calls
getStreamsToHost, but I get the same result. So, just to see if the
Garbage Collector was pulling a fast one on me, I temporarily
turned it off. But I get the same result.
It should.
Have you stepped over this line of code and verified that iStream
and oStream are set to non-nil values after this line of code?
And is all this code (getStreamsToHost:... and write:maxLength: ) in
the same function/method and if not, is the value saved/passed
between the various functions/methods?
Eli
_______________________________________________
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
_______________________________________________
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