std.socket tutorials? examples?

Cecil Ward cecil at cecilward.com
Sun Apr 30 22:10:31 UTC 2023


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 just one call to 
> select in the program, not two, the whole point is to combine 
> checks.
>
> I wrote a thing you might want to read too:
>
> http://dpldocs.info/this-week-in-d/Blog.Posted_2019_11_11.html#sockets-tutorial

How do we wait for an ‘or’ of multiple asynchronous events in 
this kind of code? In WinNT iirc there is a very nice o/s 
function that can wait on various kinds of asynch i/o, waiting on 
operations of different types if I’ve understood it correctly. 
The kind of thing I might want to do is wait on an or of IP 
packets arriving, send-completion of IP packets, timers 
completing, IPC messages coming in, key presses or event mouse 
events and the order in which these events arrive is of course 
not predictable. I might want a key press event to break out of 
something or to control an application. Everyone wants timer 
events for timeouts.


More information about the Digitalmars-d-learn mailing list