Context :
Linux debian 64. I am self learning how sockets work and it is very interesting. Single threaded application.
Question :
I am not in the clear with an async/non-blocking question. The socket is set up with fcntl(s, F_SETFL, O_NONBLOCK);
1) What exactly happens if two connections arrive exactly at the same time on one socket ?
When sockets are non blocking, will the code running the socket (call it reception) read the datas and do others stuffs with it in parallel or sequentially ? (single thread app)
I mean, with a non blocking socket, are the incoming requests treated sequentially but very fast (non-blocking operations so only the network becomes the bottleneck not the cpu) or in parallel ?
I ask because I would like to maintain a stack array in the script and cannot afford race condition when pushing datas into it.
Thanks in advance