Hack Jam Log Book is a log of progress made in and around a weekly hack session. Topics include natural language processing, high energy electronics, linguistics, interface design, &c. Enjoy.

Recent Posts:

Archives:

10.10.10

 

sockets

Hack Jam Log Book deserves a new post.

I have not been to hackjam in a while due to a great personal inconvenience in the tradeoff between space and time.

This has not limited my hacking however.

This weekend I made a great sockets program in C. It has the following features: if you run it with a certain set of flags it attempts to initiate a TCP connection with a specified host on the specified port. If you run it with a different set of flags it listens for a connection attempt on the specified port. These behaviors are meant to be used in a complementary way though you can do whatever you want with them really. After a connection is established, a message loop enters which polls both stdin and the established socket connection. Since my terminal is in some kind of cooked buffered line mode, it sucks when you are typing and the remote host sends a message, but fortunately nothing is lost except maybe the user.

There is no protocol.

This is not a lot different from telnet however it has even fewer features and capabilities.

It does however illustrate basic blocking sockets and select() in C.

It does not currently compile in Windows (maybe cygwin?) though it will soon enough -- a little WSAStartup() here and maybe some WSACleanup() there and some other smidgens and #ifdefs and we'll have it.

Code at http://jonathanstone.homeip.net:8080/chat

Direction: ncurses to solve dumb text entry problems, full Win32 support, and openssl for point-to-point encryption.

Comments: Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]