1

Topic: Non-blocking sockets

There is such situation - launched select (he waits state change of sockets) and during this moment there was a need to send the data (happen that the socket is ready to send to a call select) - how to be? - Whether it is possible as -  to pull it to write down the data?

2

Re: Non-blocking sockets

Hello, VVVa, you wrote: VVV> there is such situation - launched select (he waits state change of sockets) and during this moment there was a need to send the data (happen that the socket is ready to send to a call select) - how to be? - Whether it is possible as -  to pull it to write down the data? In  is poll and epoll, and also a certain analog of events, events. And like there would be a certain call, reformative event to a descriptor, suitable for usage in poll/epoll. Thus, you can create queue of requests about record with a certain event, and listen poll' to a socket and event, and to react accordingly.

3

Re: Non-blocking sockets

The nonsense what that if  sits on a socket, and the socket is ready to record that  at once returns  about readiness of record, on this  take and write situations which we wait  but it is already possible to write the data, does not happen

4

Re: Non-blocking sockets

In certain cases it is possible to write at once to a socket on reading  normally it on udp sockets so it is possible on tcp sockets is better to wait  for record

5

Re: Non-blocking sockets

Hello, VVVa, you wrote: VVV> there is such situation - launched select (he waits state change of sockets) and during this moment there was a need to send the data (happen that the socket is ready to send to a call select) - how to be? - Whether it is possible as -  to pull it to write down the data? Nobody hinders to tell to tell there write/send. There registers, how many gets, and if gets nothing, you will receive EWOULDBLOCK (if did not forget to translate, of course, a socket in not locked mode). But in itself such attempt of record breaks nothing, blows up nothing, and your program nobody . A question in if at you half of logically integral piece of the data how then the whirly on select' will understand when not added given to send in addition and when it is possible to send the new registers? Whether to make all around select' (and it is better - around than more modern analog, type poll/epoll, etc.) is easier And if necessity something to send arises not there where select, to organize in storage of queue on sending which the whirly on select' already and rakes?

6

Re: Non-blocking sockets

Hello, reversecode, you wrote: R> in certain cases it is possible to write at once to a socket on reading  R> normally it on udp sockets so it is possible R> on tcp sockets is better to wait  for record Reading  it is not connected in any way with  . UDP the socket is free to throw out the data directly in/dev/null if it to put them there is no place, and at TCP the socket of such freedom is not present.

7

Re: Non-blocking sockets

Yes I also did not tell anything about that that they are connected only specified as usual build architecture in similar cases