www.digitalmars.com         C & C++   DMDScript  

D - Help needed with socket.d

reply "Christian Lesage" <christian.lesage.1 agora.ulaval.ca> writes:
Hi folks!

D seems to have most important features I want in a language: garbage
collection, strings, dynamic arrays and associative arrays. I've used
scripting
languages until now because they had these features, but I always wished
there was a compiled language which would offer them. Then, I think D
deserves a try.

Easy TCP/IP is another feature I need. Pavel Minayev created the D sockets
library, "a set of classes encapsulating Windows Sockets 2 functionality".
Great. Mike Wynn posted his fixes to this library on January 23, 2003. This
is the file I am reposting here.

Now, here's my problem. Even using Mike's "socket.d", I can't compile
Pavel's example "httpget.d". The compiler yields:

C:\Program Files\DIDE\Projects\httpget\httpget.d(21): cannot create instance
of abstract class TCPSocket

Also, I think that I have to link the whole thing with "ws2_32.lib", but how
can I get this done?

I guess my questions will seem trivial to some of you. However, I would
really appreciate some help. BTW, I'm using DIDE.

Christian Lesage
Oct 06 2003
parent reply "Lars Ivar Igesund" <larsivi stud.ntnu.no> writes:
"Christian Lesage" <christian.lesage.1 agora.ulaval.ca> wrote in message
news:bltn3k$27vo$1 digitaldaemon.com...
 Now, here's my problem. Even using Mike's "socket.d", I can't compile
 Pavel's example "httpget.d". The compiler yields:

 C:\Program Files\DIDE\Projects\httpget\httpget.d(21): cannot create

 of abstract class TCPSocket

There was a recent change in the compiler that disallows instantiation of abstract classes. It means that the code must be fixed. You might find more about it in the docs. Lars Ivar Igesund
Oct 07 2003
parent reply "Christian Lesage" <christian.lesage.1 agora.ulaval.ca> writes:
 There was a recent change in the compiler that disallows instantiation of
 abstract
 classes. It means that the code must be fixed. You might find more about

 in
 the docs.

Thanks for replying. I feel like I am closer to the solution. However, the documentation doesn't tell much about "abstract" classes. Yet Another Stupid Question: What's an "abstract" class? How do you differenciate an "abstract" class from a "concrete" one? TCPSocket looks like a "concrete" class to me. It has a polymorphic constructor and a polymorphic member function "connect()". BTW, I post "httpget.d", just in case somebody feeling particularly generous have time to look into the problem... ;)
Oct 07 2003
parent "Lars Ivar Igesund" <larsivi stud.ntnu.no> writes:
"Christian Lesage" <christian.lesage.1 agora.ulaval.ca> wrote in message
news:bluqpu$q19$1 digitaldaemon.com...
 What's an "abstract" class? How do you differenciate an "abstract" class
 from a "concrete" one? TCPSocket looks like a "concrete" class to me. It

 a polymorphic constructor and a polymorphic member function "connect()".

An abstract class is a crossing between an interface and a normal class. The methods can be implemented (but don't have to be). It should be used on classes (usually base classes in a hierarchy) that makes no sense to instantiate, but that it is nice to have some code that is common for all subclasses. abstract has the same meaning in Java, an explanation can be found here: http://java.sun.com/docs/books/tutorial/java/javaOO/abstract.html Lars Ivar Igesund
Oct 07 2003