From 81038ada58567a4058833efbadbe19942d60e2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 14 Dec 2015 05:46:55 +0100 Subject: Imported Upstream version 1.1.0 --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8da3338..70bfa04 100644 --- a/README.md +++ b/README.md @@ -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) -- cgit v1.2.3