Re: std.socket tutorials? examples?

2023-04-30 Thread Cecil Ward via Digitalmars-d-learn
On Sunday, 30 April 2023 at 22:37:48 UTC, Adam D Ruppe wrote: On Sunday, 30 April 2023 at 22:10:31 UTC, Cecil Ward wrote: How do we wait for an ‘or’ of multiple asynchronous events in this kind of code? You can set a timeout value for Socket.select, but Phobos isn't going to help you with any

Re: std.socket tutorials? examples?

2023-04-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 30 April 2023 at 22:10:31 UTC, Cecil Ward wrote: How do we wait for an ‘or’ of multiple asynchronous events in this kind of code? You can set a timeout value for Socket.select, but Phobos isn't going to help you with anything other than sockets and timeouts (despite the fact the un

Re: std.socket tutorials? examples?

2023-04-30 Thread Cecil Ward via Digitalmars-d-learn
On Saturday, 29 April 2023 at 11:26:20 UTC, Adam D Ruppe wrote: On Saturday, 29 April 2023 at 10:56:46 UTC, Jan Allersma wrote: auto clientResult = Socket.select(clientSet, null, null); There's probably nothing in clientSet, so it is waiting for nothing you almost always want to have jus

Re: std.socket tutorials? examples?

2023-04-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 29 April 2023 at 10:56:46 UTC, Jan Allersma wrote: auto clientResult = Socket.select(clientSet, null, null); There's probably nothing in clientSet, so it is waiting for nothing you almost always want to have just one call to select in the program, not two, the whole point is

Re: std.socket tutorials? examples?

2023-04-29 Thread Jan Allersma via Digitalmars-d-learn
On Thursday, 4 October 2018 at 13:07:30 UTC, bauss wrote: Not exactly a tutorial or a walkthrough, but I'll try to explain basic usage of std.socket using an asynchronous tcp server as example. So I tried to code the example as described. After the program is at ```d auto clientResult = Soc

Re: std.socket tutorials? examples?

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 13:09:17 UTC, bauss wrote: On Thursday, 4 October 2018 at 13:07:30 UTC, bauss wrote: buffer = buffer[0 .. $]; // Slice the buffer to the actual size of the received data. ``` Typo... Was supposed to be "received" and not "$"... buffer = buffer[0 .. received]

Re: std.socket tutorials? examples?

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 09:54:40 UTC, Chris Katko wrote: On Thursday, 4 October 2018 at 08:52:28 UTC, Andrea Fontana wrote: On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket

Re: std.socket tutorials? examples?

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 13:07:30 UTC, bauss wrote: buffer = buffer[0 .. $]; // Slice the buffer to the actual size of the received data. ``` Typo... Was supposed to be "received" and not "$"... buffer = buffer[0 .. received]; // Slice the buffer to the actual size

Re: std.socket tutorials? examples?

2018-10-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. My book has a few examples https://www.packtpub.com/application-development/d-cookbook of course, buying it for just std.socket (which is just like one page out of the

Re: std.socket tutorials? examples?

2018-10-04 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:52:28 UTC, Andrea Fontana wrote: On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket dlang examples"... is for TANGO. That's how old it is. Socket

Re: std.socket tutorials? examples?

2018-10-04 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket dlang examples"... is for TANGO. That's how old it is. Socket paradigm is quite standard across languages. Anyway you can find a

std.socket tutorials? examples?

2018-10-04 Thread Chris Katko via Digitalmars-d-learn
I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket dlang examples"... is for TANGO. That's how old it is.