With the increasing number of electric vehicles (EVs), temporary charging demands grow rapidly. Unlike charging at home or workplace, temporary charging requires less waiting time. In this article, a mobile edge computing (MEC)-enabled charging and discharging networking system algorithm (CDNSA) is proposed to minimize the waiting time for EVs in charging stations (CSs). A software-defined network (SDN) paradigm is adopted to enhance the data transmission efficiency for MEC servers. In CDNSA, the optimization problem is formulated as a mixed-integer nonlinear programming (MINLP). A heuristic algorithm is proposed to solve the optimal CS selection variables for EVs that needs to be charged (EVCs) and EVs that can be discharged (EVDs), and then a remaining problem nonlinear programming (NLP) is obtained. By verifying the convexity of each continuous variable, the NLP is solved by adopting the block coordinate descent (BCD) method. In simulation, the optimality of CDNSA is verified by comparing with the exhaustive algorithm in terms of minimizing maximal waiting time (MMWT) of CSs. We also compare CDNSA with other benchmarks to illustrate its advantage.