diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-12-14 05:46:55 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-12-14 05:46:55 +0100 |
commit | 81038ada58567a4058833efbadbe19942d60e2c6 (patch) | |
tree | bbc45d8b43277204e0b92a64e103095907a4d341 /README.md | |
parent | 1473b84ceed2be98006bf0e9e7a0487dfa42f034 (diff) |
Imported Upstream version 1.1.0upstream/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) |