Coder Social home page Coder Social logo

sockets.hpp's Introduction

Sockets.hpp

A thin C++ wrapper around the POSIX sockets API. Support for non-blocking IO.

Usage

Find headers under <source_dir>/include/.

If you have cmake, you can build the static library as follows:

cmake <source_dir>
make

Which will spit out libSockets.a.

If you prefer not to use cmake, then something like the following should do the trick:

g++ -I include -c lib/Socket.cpp -o socket.o
ar rcs libSocket.a socket.o

You can generate a shared library similarly.

In general, you'll be using Sockets.hpp as part of another project. If you're using cmake for the other project, you can just copy (or symlink, or use git submodule) the whole source tree somewhere into your project's source tree, then in your project's CMakeLists.txt do:

include_directories("${PROJECT_SOURCE_DIR}/Sockets/include/") # Sockets.hpp
add_subdirectories (Sockets)                                  # Build the library

...

target_link_libraries (<your_project> Sockets)

License

Provided as-is. You are free to copy, redistribute, use, statically link, modify, and so on, with or without attribution. If you do find this useful, I'd like to hear about it.

Further Work

  • There are currently no tests at all. It would be nice to have some tests for this library, if it's to be relied upon.
  • There has been no trial of IPV6 or UNIX sockets at all. They might work straight out of the box.
  • There is no support for recv or send -- only read and write. The former are more powerful (and more flexible), so support should be added.
  • There is no specific support (and no testing) for non-TCP socket types.

sockets.hpp's People

Contributors

jelford avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.