Hello world/Web server task on RosettaCode fails

btiffin btiffin at gnu.org
Fri Jul 16 19:25:32 UTC 2021


Using gdc-11 and Seamonkey.  
https://rosettacode.org/wiki/Hello_world/Web_server#D does not 
compile.

```d
prompt$ gdc-11 helloServer.d
helloServer.d:12:29: error: cannot cast expression currSock = 
listener.accept() of type std.socket.Socket to bool
    12 |   while(cast(bool)(currSock = listener.accept())) {
       |                             ^
```

Then, tweaking the while loop to not cast but just run forever, 
`while (true) ...`, the code runs, but no data is shipped to 
browser.  Ctrl-U shows empty page after the accept and sendTo 
calls.

If this is the wrong place for this kind of info note, I'll 
gladly move to or redo the post in a more appropriate spot.

Have good, make well


More information about the Digitalmars-d-learn mailing list