Can't open CFWriteStream
Can't open CFWriteStream
- Subject: Can't open CFWriteStream
- From: James Walker <email@hidden>
- Date: Fri, 13 Aug 2010 13:58:55 -0700
I'm trying to set up simple one-way TCP communication between two
computers on a LAN. Conceivably my problem could be on either end, but
I think the listener is probably OK; it's similar to known working code
that listens for UDP, and Netstat indicates that I'm listening for TCP
on the right port. Oh, and I checked that the firewall is turned off on
that computer.
So, here's the sender code. What happens is that after a minute or so,
the callback gets a timeout error. Any idea what could be wrong?
CFWriteStreamRef writeStream = NULL;
CFStreamCreatePairWithSocketToHost( NULL,
CFSTR("192.168.1.165"), 10552,
NULL, &writeStream );
if (writeStream != NULL)
{
NSLog(@"Created stream");
CFStreamClientContext contextRec =
{
0, self, NULL, NULL, NULL
};
CFWriteStreamSetClient( writeStream,
kCFStreamEventOpenCompleted |
kCFStreamEventCanAcceptBytes |
kCFStreamEventErrorOccurred |
kCFStreamEventEndEncountered,
StreamCallBack, &contextRec );
CFWriteStreamScheduleWithRunLoop(
writeStream, CFRunLoopGetMain(),
kCFRunLoopCommonModes );
if (CFWriteStreamOpen( writeStream ))
{
NSLog(@"stream open started");
}
else
{
NSLog(@"CFWriteStreamOpen returned false");
}
}
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
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