Mnemonic TCP support library
General Info

Introduction
Screenshots
Mailing Lists and IRC
Alternative Browsers
Special Thanks

FAQ
Understanding Mnemonic
TODO list and ideas
Bug Reports


User Info

Download binaries
Platforms
Compiling Mnemonic
Other useful software


Developer Info

Core
Message modules
Library modules
Object modules
Coding Guidelines
Browse Source
Using CVS


View with any browser

Website questions to:
webmaster@mnemonic.org

Mnemonic questions to:
disc@mnemonic.org

 

TCP connection support library

The lib-tcpconnection module contains a library for multi-threaded access to network services based on TCP/IP. It supports proxies as well as secure sockets (using the SSLeay library).

TODO: This library is a bit outdated as it is not really C++ (uses return values in some places instead of exceptions, does still use plain C buffers etc.).

Using it

Using lib-tcpconnection is very straightforward. You initialise a tcp_connection structure by giving it a hostname and port number, eg.

tcp_connection myconn("localhost",8000);
Before connecting, you need to make it lookup the hostname. If that is successful, connect to the host:
if(myconn.lookup()!=0)
  return false;
if(myconn.connect()!=0)
  return false;
Reading data from the connection is now simply a matter of calling the read member with a pointer to a buffer.
char buffer[1024];
while(myconn.read(buffer,1024)>0) {
   // use data
   }
Similarly, use write to write something to the connection. The connection is closed automatically upon destruction.

Proxies

If you initialise the connection object with a second host/port pair, these will be used to connect to a proxy instead. Use the uses_proxy call to determine whether a given connection uses a proxy.

For proxy support according to SOCKS version 5 as specified in rfc1928.txt we will probably use the reference implementation from NEC. Although the minimalistic forward option seems ok for the time being. We do not yet support automatic proxy configuration along the lines of Netscape's x-ns-proxy-autoconfig format.

Secure sockets using SSLeay

If you have SSLeay installed, or if you have pointed autoconf at the SSLeay directory using --with--ssleay=DIR, lib-tcpconnection will support the use of secure sockets.

The SSLeay library is available at

ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/
More information can be obtained from the SSLeay FAQ. There is also some documentation written by Eric Young.