[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Socket with g++



Hi,

On 13 Jul, Bernhard Rieder wrote:
 > ACE seems a good library but I do not need the portability (especially to
 > Windoze) and I think its too complicated to use.

Hmm, I have to disagree with you.  ACE is not only a good library but
it can be as easy to use as you'd like (see below).

 > I just want a library
 > where I can say:
 >   S = new Socket();
 >   S.connect("localhost",12345);
 >   iostream sb(S.sockbuf());
 >   sb << "Hallo. Give me a number";
 >   sb >> int i;
 > That is a Feature that ace is currently missing.

Nope.  See below.

 > A sockbuf class
 > derived vom streambuf that is enables the use of the standard
 > stream classes that makes it as easy to use sockets for in/output.

You mean something like:

	#include <ace/SOCK_Stream.h>
	#include <ace/SOCK_Connector.h>
	#include <ace/IOStream.h>

	int main (int, char*[])
	{
	  ACE_SOCK_Stream S;
	  ACE_SOCK_Connector C (S, ACE_INET_Addr (80, "www.foo.com"));
	  ACE_IOStream<ACE_SOCK_Stream> I (S);

	  int i;

	  I << "Hello, give me a number" << endl;
	  I >> i;

	  return 0;
	}

Doesn't this behave exactly as you described?  This isn't complex at
all. I haven't actually run the above code, but I think you can see
what it is supposed to do and how simple it is to do what you describe.
:-)

 > PS: I really do NOT want the portability to Windoze + Winsock.

Then don't run you're apps on Windbloze. :)  This has no bearing on the
quality of ACE or any other library.  ACE is completely Open Source. In 
fact, there is even a Debian ACE package (libace*) in the main Debian
archive.  Shouldn't that be enough?

HTH,
-Ossama

-- 
Ossama Othman <othman@cs.wustl.edu>
Center for Distributed Object Computing, Washington University, St. Louis
58 60 1A E8 7A 66 F4 44  74 9F 3C D4 EF BF 35 88  1024/8A04D15D 1998/08/26


Reply to: