Simple Network Client Design (newbie alert)
Simple Network Client Design (newbie alert)
- Subject: Simple Network Client Design (newbie alert)
- From: Ross Hayden <email@hidden>
- Date: Wed, 30 Jan 2002 10:42:48 -0500
When I was learning network programming on Unix, I wrote a simple TCP
client and server pair, where the server would echo back the lines of text
sent to it by the client. I typed in a line of text at my client, which
then sent it to the server which would send it back to the client and
display on my terminal.
I'm trying now to rewrite the client in Cocoa.
I've redesigned it so that reading from the socket blocks in a thread and
doesn't hold up my user interface. I hope that's the best way to do that?
I created an NSTextView in which to display text echoed back from the
server. My problem here is understanding how I can inject data into an
NSTextView from my socket reader thread. I tried using setString: but
what happens is that only the top three lines of my NSTextView ever fill
with text before scrolling starts, even though the NSTextView box itself
is large enough to display about 15 lines.
I also tried insertText: which never displays a thing.
I'm clearly lost here! Any help is much appreciated.
Ross