1

Topic: Multi-threaded reading on UDP

Colleagues, greetings. Whether prompt, please, it is possible to read from several flows the data from the same UDP-socket? Whether the data will be lost and-or damaged? And what documentation can be esteemed on this subject? I could  that recv/recvfrom are , i.e. they can be caused simultaneously. But what will be dataful which they read? Whether will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow?

2

Re: Multi-threaded reading on UDP

Hello, DTF, you wrote: DTF> And what documentation it is possible to esteem on this subject? About sockets... DTF> But what will be dataful which they read? The next datagram (if gets into the input buffer) returns whether DTF> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? UDP protocol does not beat the datagram on a part.

3

Re: Multi-threaded reading on UDP

Hello, Nikolay_Ch, you wrote: N_C> About sockets... It is clear... But in articles which I , about it explicitly am not painted. It is possible the link to a specific place in the documentation? N_C> the next datagram (if gets into the input buffer) And if does not get Returns? Residual will be discarded or gets to another recv? N_C> UDP Protocol does not beat the datagram on a part. And a question not about network UDP protocol, and about API through which the data is read.

4

Re: Multi-threaded reading on UDP

Whether DTF> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? Yes and will be where read there and the sense leaves what generally to use recvfrom on one socket from different flows? How you then will glue that data? Generally it is necessary to specify Windows or , at all of them on a miscellaneous it is arranged

5

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: whether DTF>> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? R> yes and will be do not mislead. Datagrams do not fight on a part.

6

Re: Multi-threaded reading on UDP

N_C> do not mislead. Datagrams do not fight on a part. There is no warranty that recvfrom returns you of 100 % the full piece of the reasons the datagram can +10500 in OS fights on small  mbuf

7

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> generally it is necessary to specify Windows or , at all of them on a miscellaneous it is arranged And what in this case there will be a difference, the buffer that one?

8

Re: Multi-threaded reading on UDP

Hello, DTF, you wrote: N_C>> About sockets... DTF> It is clear... But in articles which I , about it explicitly am not painted. DTF> it is possible the link to a specific place in the documentation? I got used to be guided on MSDN... There there is extensive chapter Windows Sockets... N_C>> the next datagram Returns (if gets into the input buffer) DTF> And if does not get? Residual will be discarded or gets to another recv? In  it is not strong, and in Windows the greatest possible amount is by default copied, remaining is discarded, i.e. lost for ever. Clear business that thus  an error - buffer overflow. N_C>> UDP protocol does not beat the datagram on a part. DTF> and a question not about network UDP protocol, and about API through which the data is read. There are two paradigms - datagrams and flows. API sockets works in these paradigms.

9

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: N_C>> do not mislead. Datagrams do not fight on a part. R> there is no warranty that recvfrom returns you of 100 % the full piece Is. If the datagram is not received completely, recvfrom does not return you anything. In it and difference of datagrams-paradigms from flows TCP. R> the reasons the datagram can +10500 R> in OS fights on small  mbuf . The UDP-datagram fights on IP-datagrams which, in turn, fight on Ethernet-frames... TCP, by the way, too fights. Also what, it somehow changes a paradigm of datagrams and flows?

10

Re: Multi-threaded reading on UDP

S> And what in this case will be a difference, the buffer that one? In Windows IOCP it pisix api there can

11

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> in Windows IOCP R> it pisix api there can  And in Niksah, unless not POSIX-sockets?

12

Re: Multi-threaded reading on UDP

Initially my thought was another if UDP that is used for what sending of the packaged flow that 1) catching of packets recvfrom from different flows and  in the general queue (the flow that is sent one) - in any way does not accelerate 2) the buffer for catching can be less than the biggest piece of the sent packet and then we catch a smaller piece, we quit with recvfrom And? Other flow we catch the rest? You contracted into the same subject where, we admit the maximum size which is caught in  65536 byte, almost 65  mbuf if I am not mistaken 4096 bytes, 4 kilobytes the come datagram in 65536 byte, and casually not sufficed a place in the buffer (began clusters  on 4 and did not suffice, well differently happens in OS) will be wetted hardly already on the accepted side (only I assume) variants two, 1) presoaks giving to the user an error (artful OS) 2) not to wet and give to the user so much how many came (friendly OS) to climb to look at least in  about that as generally behave in such situations of OS, I do not want

13

Re: Multi-threaded reading on UDP

In  they not iocp and in Windows posix lies on top iocp as far as I know, i.e.  the author did not specify what wasps and what functions but with IOCP there are thoughts that all will work on another, well i.e. there the Windows on flows scatters all generally still in  is recvmsg so can eat sense with them to be played for catching  buffer counts

14

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> initially my thought was another R> if UDP that is used for what sending of the packaged flow R> that R> 1) catching of packets recvfrom from different flows and  in the general queue (the flow that is sent one) - in any way does not accelerate R> 2) the buffer for catching can be less than the biggest piece of the sent packet, R> and then we catch a smaller piece, we quit with recvfrom And? Other flow we catch the rest? We cannot catch smaller or the most part... We select the next datagram from the come. If it does not get into the buffer that we lose the datagram completely. No Axis will select that from entering datagrams that gets in transferred recvfrom the buffer. R> you contracted into the same subject where, we admit the maximum size which we catch in  65536 byte, almost 65  R> mbuf if I am not mistaken 4096 bytes, 4 kilobytes Yes this does not concern mbuf the buffer storing entering datagrams of a socket. . R> the come datagram in 65536 byte, R> and casually not sufficed places in the buffer (began clusters  on 4 and did not suffice, well differently happens in OS) R> will be wetted hardly already on the accepted side (only I assume) R> variants two, 1) presoaks giving to the user an error (artful OS) R> 2) not to wet and give to the user so much how many came (friendly OS) R> to climb to look at least in  about that as generally behave in such situations of OS, do not want And costs Because you described variants of mythical behavior which is not present in POSIX-sockets. At least I about such behavior never heard. Any option which forces sockets so to work, but by default they can and is I work on another. If the datagram is not accepted completely on the client (i.e. it is not put in the entering buffer of a socket), recvfrom locks program execution (if it did not translate in a non-blocking mode). Also will not be the first second variant. The first - the client does not receive an error that any datagram did not get into the buffer of a socket from an entering network. The second - because so UDP-sockets do not work.

15

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> in  they not iocp R> and in Windows posix lies on top iocp as far as I know, i.e.  And what difference? recvfrom where where, and on Windows precisely works how I wrote. R> the author did not specify what wasps and what functions R> but with IOCP there are thoughts that all will work on another, well i.e. there the Windows on flows scatters all recvfrom are POSIX like as... R> generally still in  is recvmsg so can eat sense with them to be played for catching  What buffer counts of buffers, excuse? There is an entering buffer of a socket and there datagrams are added. Them not one, not two and much...

16

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: whether DTF>> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? R> yes and will be Not so will not be. You mislead the person. See: IEEE Std 1003.1, 2004 Edition: For message-based sockets, such as SOCK_RAW, SOCK_DGRAM, and SOCK_SEQPACKET, the entire message shall be read in a single operation. man 2 socket: SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams to correspondents named in sendto (2) calls. Datagrams are generally received with recvfrom (2), which returns the next datagram along with the address of its sender. MSDN: recvfrom function: The recvfrom function receives a datagram and stores the source address. And further  to mbuf in a root incorrectly. R> where read there and the sense leaves R> what generally to use recvfrom on one socket from different flows? R> as you then will glue that data? If  it is possible to process parallely all it is comprehensible it is scaled. R> generally it is necessary to specify Windows or , at all of them on a miscellaneous it is arranged Logic of operation of that API that copied at BSD at them differs unless in shutdown/close. All remaining is amazingly identical.

17

Re: Multi-threaded reading on UDP

N_C> We cannot catch smaller or the most part... We select the next datagram from the come. N_C> if it does not get into the buffer that we lose the datagram completely. No Axis will select that from entering datagrams that gets in transferred recvfrom the buffer. Apprx. forced the old man to climb in Google Google speaks that if the datagram more than the buffer that gets to the buffer that gets, remaining is discarded N_C> And costs Because you described variants of mythical behavior which is not present in POSIX-sockets. At least I about such behavior never heard. Any option which forces sockets so to work, but by default they can and is I work on another. N_C> if the datagram is not accepted completely on the client (i.e. it is not put in the entering buffer of a socket), recvfrom locks program execution (if it did not translate in a non-blocking mode). Also will not be the first second variant. The first - the client does not receive an error that any datagram did not get into the buffer of a socket from an entering network. The second - because so UDP-sockets do not work. To wet the datagram already on the client from for that that problems with storage not comme il faut here laziness to me to climb in kernels  what to see as they arrive

18

Re: Multi-threaded reading on UDP

Hello, DTF, you wrote: whether DTF> Prompt, please, it is possible to read from several flows the data from the same UDP-socket? Whether it will be possible DTF> so, what one piece of the datagram leaves in one flow, and other piece - in other flow? It does not turn out

19

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> there is no warranty that recvfrom returns you of 100 % the full piece R> the reasons the datagram can +10500 R> in OS fights on small  mbuf These are internal problems of OS. recvfrom () from  a socket does one or the other: or finds one whole datagram, or returns an error. The datagram never fights between two serial recvfrom ()

20

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: N_C>> We cannot catch smaller or the most part... We select the next datagram from the come. N_C>> if it does not get into the buffer that we lose the datagram completely. No Axis will select that from entering datagrams that gets in transferred recvfrom the buffer. R> apprx. forced the old man to climb in Google R> Google speaks that if the datagram more than the buffer that gets to the buffer that gets, remaining is discarded Well so and I about what? Only it is the buffer which you transferred in recvfrom... In my opinion you are confused in buffers... And there it is a lot of them - at each level the. Ethernet, IP, UDP, SOCKET... And at each level the datagram (or something other) the. And while at the next level the datagram of an upper layer it will not be accepted completely does not rise upwards.

21

Re: Multi-threaded reading on UDP

Hello, m2l, you wrote: m2l> Hello, reversecode, you wrote: whether DTF>>> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? R>> yes and will be m2l> Not so will not be. You mislead the person. m2l> see: m2l> IEEE Std 1003.1, 2004 Edition: For message-based sockets, such as SOCK_RAW, SOCK_DGRAM, and SOCK_SEQPACKET, the entire message shall be read in a single operation. m2l> man 2 socket: SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams to correspondents named in sendto (2) calls. Datagrams are generally received with recvfrom (2), which returns the next datagram along with the address of its sender. m2l> MSDN: recvfrom function: The recvfrom function receives a datagram and stores the source address. Already more low on a subject understood m2l> And further  to mbuf a root incorrectly. R>> where read there and the sense leaves R>> what generally to use recvfrom on one socket from different flows? R>> as you then will glue that data? m2l> if  it is possible to process parallely all it is comprehensible it is scaled.  the safe yet does not mean that two flows can cause recvfrom and at once receive under datagram R>> generally it is necessary to specify Windows or , at all of them on a miscellaneous is arranged m2l> Logic of operation of that API that copied at BSD at them differs unless in shutdown/close. All remaining is amazingly identical. I about IOCP instead of about covered posix on top

22

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> in Windows IOCP R> it pisix api there can  You  speak IOCP, mean I/O completion port? If yes, it here at what?

23

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R>  the safe yet does not mean that two flows can cause recvfrom and at once receive under the datagram Thread safety does not guarantee presence of the data... It as though from a different opera of a thing... R> I about IOCP instead of about covered posix on top And library SOCKETS works at level POSIX

24

Re: Multi-threaded reading on UDP

Hello, DTF, you wrote: whether DTF> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? I that will not be.

25

Re: Multi-threaded reading on UDP

N_C> Well so and I about what? Only it is the buffer which you transferred in recvfrom... N_C> In my opinion you are confused in buffers... And there it is a lot of them - at each level the. Ethernet, IP, UDP, SOCKET... N_C> and at each level the datagram (or something other) the. And while at the next level the datagram of an upper layer it will not be accepted completely does not rise upwards. I in buffers am not confused, it you were tangled about what buffers I each time I tell in a context  buffers, I meant already unpacking of the data of the datagram for preparation in the buffer whence already given leave the user shifted to the Left clearly that if there was no storages or an error on  or  level that to the user that that that to tell sense was not present, all in the silent is wetted