Yes, infile does contain data. I figured out the problem, When I start all the nodes using roslaunch, infile is not invoked but when I start the nodes using rosrun twice(for each node) everything is working perfectly fine (Even the entire vector is published in the subscriber). Why is this so?