diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-12-14 05:46:57 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-12-14 05:46:57 +0100 |
commit | f6a1b1096746933d69d843cc71289835951d307a (patch) | |
tree | c10602db74d3bfde67984380fd3733266ce465ec /README.md | |
parent | 0145bb6ab005cfaaac228bde478bf677d0bea135 (diff) | |
parent | 81038ada58567a4058833efbadbe19942d60e2c6 (diff) |
Merge tag 'upstream/1.1.0'
Upstream version 1.1.0
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 47 |
1 files changed, 45 insertions, 2 deletions
@@ -1,13 +1,14 @@ psocksxx ======== +[![GitHub release](https://img.shields.io/github/release/nukedzn/psocksxx.svg)](https://github.com/nukedzn/psocksxx/releases) [![Build Status](https://travis-ci.org/nukedzn/psocksxx.svg)](https://travis-ci.org/nukedzn/psocksxx) A C++ wrapper for POSIX sockets ## Copyright and License -Copyright (C) 2015 Uditha Atukorala. +Copyright (C) 2013-2015 Uditha Atukorala. This software library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -49,7 +50,7 @@ You can download source distributions from https://github.com/nukedzn/psocksxx/r ### Debian/Ubuntu packages -Please check availability for your distribution first ([Debian](https://packages.debian.org/search?searchon=names&keywords=psocksxx), [Ubuntu](http://packages.ubuntu.com/search?suite=wily§ion=all&arch=any&keywords=psocksxx&searchon=names)). +Please check availability for your distribution first ([Debian](https://packages.debian.org/psocksxx), [Ubuntu](http://packages.ubuntu.com/psocksxx)). $ sudo aptitude update $ sudo aptitude install libpsocksxx-dev @@ -80,6 +81,48 @@ autotools. After that you can use the usual `./configure && make` +## Usage + +Please take a look at [examples](https://github.com/nukedzn/psocksxx/tree/master/src/examples) +for more details. + +### Simple Server + +``` c++ + +// tcp socket stream +psocksxx::tcpnsockstream ss; + +// network address to bind to +psocksxx::nsockaddr naddr( "localhost", "21555" ); + +// bind and listen +ss.bind( &naddr, true ); +ss.listen(); + +// accept a connection +psocksxx::nsockstream * css = ss.accept(); + +``` + +### Simple Client + +``` c++ +// tcp socket stream +psocksxx::tcpnsockstream ss; + +// connect +ss.connect( "localhost", 21555 ); + +// send a message +ss << "hello" << std::endl; + +// receive a message +std::string msg; +ss >> msg; +``` + + ## API Documentation * [v1.0](https://nukedzn.github.io/psocksxx/docs/v1.0) |