I have to write a relatively simple application in Cocoa which involves setting up a TCP socket which listens on port 6789, creates a new incoming connection, reads one string and then closes the socket. That's really all it has to do, but it's apparently quite hard... I'm new to the whole mac programming and networking appears to be tough. Can someone help me by supplying some sample code on how to achieve this?