How To Clean Your Socks
There are several ways to get the cleansocks library. If you need any help with any of these, don't be afraid to ask. If you have a laptop, feel free to bring it by the office and I'll be glad to help you get set up.

Binary Distribution

  1. The library is installed on the Sandbox server. You are allowed to have shell account there. Ask Dr. Bennet if you want one.
  2. RPMs for Linux. RPM is the package manager on Red Hat, Fedora and several other distributions. Not, unfortunately, on Ubuntu and Mint.
    libcleansocks-0.1.4-3.x86_64.rpm
    libcleansocks-0.1.4-3.src.rpm
    Once the RPM is installed, you should be able to compile client programs by adding -lcleansocks to the end of the compile command.
  3. If you must use Windows, this binary distribution should work with CodeBlocks. No fancy installer. These instructions are for adding the library globally, but it is possible to add it to a specific project instead. Look here.
    1. Download the Windows binary distribution libcleansocks_win-0.1.4.zip. This is built with the (latest) standard download of CodeBlocks (13.12) using the gcc compiler 4.7.1.
    2. Unpack it anywhere you like, but remember where.
    3. Choose the settings menu which gives you a drop-down. Select “compiler” to get a complex pop-up.
    4. Choose the tab for “Search Directories”. You should see something like this:
    5. Push the Add button. Use the pop-up to enter the full path of the directory containing the unpacked files. The name should now appear:

      Of course, your location may differ. This adds the listed directory to the places the compiler will search for #include files.
    6. Click on the Linker tab (right of Compiler, still under Search directories) and add the same directory path there. This adds the directory to the places to search for link libraries.
    7. Now click on the Linker settings tab just left of Search directories. Add the line -lcleansocks -lws2_32 to the right-hand options window like this:

      This tells the system to actually load the Cleansocks library, and also the Winsock2 library that implements sockets on Windows.
    8. Press OK.
  4. If you want to run on a Mac, you'll have to compile the library source yourself. I don't have access to a Mac, so I can't provide a binary version. The Linux instructions (below) may work, though it may be necessary to modify the source code.

Source Distribution

If you want or need to compile the source yourself,
  1. The source distribution should build easily on Linux. Simply unpack it and type make. By default, the installer places the library in /usr/local/lib, which can be a problem on Fedora, which doesn't enable the local library area by default. You can either install in the main area by saying make INSTALLBASE=/usr install, or you can enable the local area, and just say make install. To enable the local area, simply create a text file named /etc/ld.so.conf.d/local.conf containing just two lines:
    /usr/local/lib64 /usr/local/lib
    If you have a 32-bit system, you can leave off the first one, though it probably won't hurt anything. Do this before you make install.

    I don't know if other distributions enable this by default; you'll have to check. There are several ways to do this, and the file layout need not be the same.

  2. I compiled the Windows binary distribution using CodeBlocks, versions mentioned above. I created a static library project, added the six files cleansocks.h, cleansocks.cpp, cleanip.h, cleanip.cpp , cleanbuf.h and cleanbuf.cpp, then built the project. CodeBlocks created a .a file with no problems.
  3. The source distribution should also build on Windows using the MinGW package, with MSys. I have not tried with this version, but earlier ones worked. Use the make INSTALLBASE=/usr form. If you don't know what MinGW is and want to, ask me about it.