Let me clarify my situation to explain the topic better. I am talking about a C code that used network sockets provided by the OS. Many such clones of the program are running simultaneously and these interact among themselves using the BSD sockets.
I really got expected execution sometimes by just repeating the whole process of execution just one more time for confirmation... And what happens, it executes properly!!
With all these experiences of mine, I thought about jotting down some common factors that may affect socket programming..
Pointers for socket programming:
- Never give up with just one wrong execution of the program. Try at least 2 times.
- Carefully choose your buffer sizes. No error is flagged and this is a very easy way of losing data while transmitting or receiving.
- DON'T flood the network with packets continuously with packets from different sources to different destinations. It just does not work!! Give some breathing time for it to transmit the packets successfully.