Vehicular ad hoc networks (VANETs) are the emerging field, which deals with a set of communicating vehicles that are able to deploy Intelligent Transportation Systems (ITS). In this kind of networks, it is difficult to make an ideal configuration of the communication protocols. In this work, we consider a problem which lies in configuring the File Transfer Protocol configuration with the aim of optimizing the amount of data transferred, the transmission time and the number of lost packets in realistic VANET scenarios. In order to do this we have used metaheuristic algorithms, which lie in searching efficient parameters setting of VDTP protocol. The VDTP protocol has been tested by employing five different parameter settings: PSO, DE, GA, ES, and SA. For our tests, two different environment instances of VANETs for Urban and Highway scenarios have been taken. The experiments using ns-2 prove that PSO outperforms all the compared algorithms.