www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D 2.0 Sockets

reply Kai Ninomiya <kainino1 gmail.com> writes:
Hello all,

A friend and I recently attempted to write a simple bidirectional 
networking (eg. chat) application in D 2.0. We ran into some trouble, 
and as this was the first time we had dealt with sockets we struggled 
with it quite a bit. We then tried very similar code in Java (in case of 
an error in the D2 libraries, possibly), we didn't have much trouble at 
all getting it up and running.

The problems we encountered in D2, as best as I can remember them, were 
(a) enabling blocking on sockets did not seem to work, and (b) sending 
packets back from client to server caused the server to receive either 
nothing or an empty packet (I don't remember).

So here is my request: Could someone with some experience in sockets 
more-or-less-translate the following C code into a very simple D2 
example with similar functionality? (As I said, it might turn out to be 
a library problem, though I couldn't find any messages or bug reports 
about it.)

Thanks in advance.

http://www.linuxhowtos.org/data/6/server.c
http://www.linuxhowtos.org/data/6/client.c
(from http://www.linuxhowtos.org/C_C++/socket.htm)
May 03 2010
parent reply Jesse Phillips <jessekphillips+D gmail.com> writes:
Kai Ninomiya wrote:

 Hello all,

 A friend and I recently attempted to write a simple bidirectional 
 networking (eg. chat) application in D 2.0. We ran into some trouble, 
 and as this was the first time we had dealt with sockets we struggled 
 with it quite a bit. We then tried very similar code in Java (in case of 
 an error in the D2 libraries, possibly), we didn't have much trouble at 
 all getting it up and running.
If you're using Linux, then you're probably running into this issue: http://d.puremagic.com/issues/show_bug.cgi?id=2835
May 03 2010
parent Kai Ninomiya <kainino1 gmail.com> writes:
On 5/3/2010 10:15 AM, Jesse Phillips wrote:
 If you're using Linux, then you're probably running into this issue:

 http://d.puremagic.com/issues/show_bug.cgi?id=2835
Both of us were using both Windows and Linux at different times, and we both tested locally. I will look into this bug/patch further though, in case it is related. Thanks.
May 03 2010