Unix sockets echo example

Some stuff that came up at the office got me curious about Unix network programming. Fortunately I have a few books here that touch on that topic (both Advanced Programming in the UNIX Environment and Advanced MAC OS X Programming), and I found a good writeup online (on IBM’s website curiously enough) on making a simple server and client example.

I’m not going to bother putting it on GitHub since it’s exactly what’s on the IBM site (although not all together – they split it up a bit), so just as future reference in case I lose it here is the Server code, and here is the Client code.

I don’t 100% understand everything going on here, but it won’t take more than another evening’s work to get it down. I’m on board with the data structures, but I have yet to dig into connect(), send(), and recv().

Hmm… I’ve dipped my toe in both graphics and network programming now. I should put “network multi-player Pong clone” on my list of things to try as a proof of concept.

This entry was posted in Hobbies, Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s