Finally I stuck on a solution for the same. Why not have another file which will store the name of the previous image installed and then whenever we go towards installing the next image this previous image name is read out and compared to the one existing in the Client-Server mapping file.
The logic was simple and the implementation even simpler. I seem to be making progress in C and reviving my old skill set a lot.
The limitations of this approach. Currently, I can see one only, which is when we have two system simultaneously starting off and one is a server or both are server images. Then, if between the time frame that one finishes and the second starts, no machine is free to load the image, we might face a situation wherein the first server that finished imaging will never have the client load, as the last image file will be overwritten. Need to find something to circumvent this problem.