www.digitalmars.com         C & C++   DMDScript  

D - Socket

reply "Phill" <phill pacific.net.au> writes:
Can anyone tell me how I can create a Socket
in D?
I have tried the following:
---------------------------
extern(Windows)
{
 SOCKET socket (int af, int type,  int protocol );
 }
-----------------------
From that
I get the following error:
 identifier 'SOCKET' is not defined

then later on I planned to do this:
----------------------------
Socket sock;
 if(sock.Create(port,SOCK_STREAM,NULL)){
  printf( "csock is created!" );
  }
------------------------

Are there ways to create a Socket in D yet?

Please dont say "use COM". Im on a big enough learning
curve as it is.

Phill
Feb 13 2004
parent reply Vathix <vathix dprogramming.com> writes:
Phill wrote:

 Can anyone tell me how I can create a Socket
 in D?
 I have tried the following:
 ---------------------------
 extern(Windows)
 {
  SOCKET socket (int af, int type,  int protocol );
  }
You would need to alias int SOCKET; as well. There are already some winsock.d files floating around with all this done, including my site. -- Christopher E. Miller www.dprogramming.com irc.dprogramming.com #D
Feb 13 2004
next sibling parent Sean Kelly <sean ffwd.cx> writes:
Vathix wrote:
 You would need to alias int SOCKET; as well. There are already some 
 winsock.d files floating around with all this done, including my site.
One of these days I want to sit down and work out a multiplexed io spec for D but the language needs things like standard containers first. Sean
Feb 13 2004
prev sibling parent "Phill" <phill pacific.net.au> writes:
Ok, thanks I will take a look!

Phill.


"Vathix" <vathix dprogramming.com> wrote in message
news:c0idae$1iub$1 digitaldaemon.com...
 Phill wrote:

 Can anyone tell me how I can create a Socket
 in D?
 I have tried the following:
 ---------------------------
 extern(Windows)
 {
  SOCKET socket (int af, int type,  int protocol );
  }
You would need to alias int SOCKET; as well. There are already some winsock.d files floating around with all this done, including my site. -- Christopher E. Miller www.dprogramming.com irc.dprogramming.com #D
Feb 13 2004