Is there any need for this? *library*

Started by
6 comments, last by Basiror 18 years, 9 months ago
Hi I am just wondering if anyone here needs a cross platform c++ library for sockets programming? I am currently working on a library with the following features/properties for a private project that needs to run on windows and linux servers: it features the following: - wrapper for sockets - some routines to setup sockets with a single function call to reduce the amount of code you have to write to get it working - all socket functions wrapped use BOOL to determine success or failure the send and receive functions got an extra parameter by reference to get the number of bytes written/read - a few things i ll add to the library are a pooled allocator which can be used with stl lists to reduce memory fragmentation and maybe some other useful things i need in the project cya
http://www.8ung.at/basiror/theironcross.html
Advertisement
sounds good, any chance that we could see it?
i am still working on maybe at the end of the week maybe a little bit earlier i am still writing the allocator for stl and need to run some tests to verify the specifications
http://www.8ung.at/basiror/theironcross.html
A socket library modeled after - and, even, interchangable with - std::streams would be very nice.

Also; unless this pooled allocator is used directly by the library, do not include it. It isn't part of that library.
doing this is pretty easy

the iostreams are modelled on top of the stdin and stdout and stderr *at least thats what i have read in the headers*

on linux sockets are just filedescriptors which you can duplicate with dup2 see "man 2 dup2"
so all you do is you use dup2 on stdin and stout and voila done

on windows this is a little bit more difficult, in fact i know of no way to redirect the stdin and stdout to a socket

the poor posix implementation they have shall be broken so i don t know if its possible at all


does anyone know?
http://www.8ung.at/basiror/theironcross.html
Well you're basicly off-base to begin with, sure cout, cin, cerr and clog are bound to stdout, stdin and stderr by default but they're not "modled" after them. They use streambuf's to handle output basicly what you want to do is create a customized streabuf using a socket then you can rebind any stream (including standardstreams) to use that streambuf.

The process is a bit simpler on unices since you can create a file based streambuf and connect that to a socket but since your'e doing a socket library that shouldn't really matter much.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
hm am i right in the assumption that i only have to overwrite the get and put functions of streambuf?

if yes ill propably mess around with it
http://www.8ung.at/basiror/theironcross.html
i just read through around 20 pages of stream documentation
http://www.atnf.csiro.au/computing/software/sol2docs/manuals/stdlib/user_guide/loc_io/18_3.htm

here they give a pretty good example on how to proceed

derive streambuf

implement your buffer and socket work there

overwrite some member functions

and with the operator=(streambuf &..) you assign it to the stream you want to use

i am not sure if i will put this into the first release
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement