summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md47
1 files changed, 45 insertions, 2 deletions
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&section=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)