A first electronic device (200, 201; 1201, 1203, 1205) comprising: a communication circuit (220, 250; 320) configured to support a vehicle-to-everything, V2X, communication method and a Wireless Fidelity, Wi-Fi, direct communication method; and at least one processor (210, 240; 310) electrically connected to the communication circuit, at least one memory (230, 260; 330) electrically connected to the at least one processor, wherein the at least one processor (210, 240) is configured to: obtain Wi-Fi direct connection information about a plurality of second electronic devices (1202, 1204, 1206) using the V2X communication method, wherein the Wi-Fi direct connection information includes at least one of an Internet Protocol, IP, address, a key, a Wi-Fi simple configuration information element, WSC IE, or a peer to peer information element, P2P IE; store, in advance through V2X communication, the obtained Wi-Fi direct connection information for the plurality of second electronic devices, including the at least one of an IP address, a key, a WSC IE or a P2P IE, in the memory; set reachability values for the plurality of second electronic devices based on distances between the first electronic device and the plurality of second electronic devices, wherein a reachability value of the plurality of second electronic devices is determined by comparing a distance between the first device and the second electronic device with a threshold for the Wi-Fi direct communication; determine candidate electronic devices among the plurality of second electronic devices using the set reachability values, wherein reachability values of the candidate electronic devices indicate that distances between the first electronic device and the candidate electronic devices are within the threshold for the Wi-Fi direct communication; and establish a connection for the Wi-Fi direct communication with one of the candidate electronic devices by using the stored Wi-Fi direct connection information. a communication circuit (220, 250; 320) configured to support a vehicle-to-everything, V2X, communication method and a Wireless Fidelity, Wi-Fi, direct communication method; and at least one processor (210, 240; 310) electrically connected to the communication circuit, at least one memory (230, 260; 330) electrically connected to the at least one processor, wherein the at least one processor (210, 240) is configured to: obtain Wi-Fi direct connection information about a plurality of second electronic devices (1202, 1204, 1206) using the V2X communication method, wherein the Wi-Fi direct connection information includes at least one of an Internet Protocol, IP, address, a key, a Wi-Fi simple configuration information element, WSC IE, or a peer to peer information element, P2P IE; store, in advance through V2X communication, the obtained Wi-Fi direct connection information for the plurality of second electronic devices, including the at least one of an IP address, a key, a WSC IE or a P2P IE, in the memory; set reachability values for the plurality of second electronic devices based on distances between the first electronic device and the plurality of second electronic devices, wherein a reachability value of the plurality of second electronic devices is determined by comparing a distance between the first device and the second electronic device with a threshold for the Wi-Fi direct communication; determine candidate electronic devices among the plurality of second electronic devices using the set reachability values, wherein reachability values of the candidate electronic devices indicate that distances between the first electronic device and the candidate electronic devices are within the threshold for the Wi-Fi direct communication; and establish a connection for the Wi-Fi direct communication with one of the candidate electronic devices by using the stored Wi-Fi direct connection information. obtain Wi-Fi direct connection information about a plurality of second electronic devices (1202, 1204, 1206) using the V2X communication method, wherein the Wi-Fi direct connection information includes at least one of an Internet Protocol, IP, address, a key, a Wi-Fi simple configuration information element, WSC IE, or a peer to peer information element, P2P IE; store, in advance through V2X communication, the obtained Wi-Fi direct connection information for the plurality of second electronic devices, including the at least one of an IP address, a key, a WSC IE or a P2P IE, in the memory; set reachability values for the plurality of second electronic devices based on distances between the first electronic device and the plurality of second electronic devices, wherein a reachability value of the plurality of second electronic devices is determined by comparing a distance between the first device and the second electronic device with a threshold for the Wi-Fi direct communication; determine candidate electronic devices among the plurality of second electronic devices using the set reachability values, wherein reachability values of the candidate electronic devices indicate that distances between the first electronic device and the candidate electronic devices are within the threshold for the Wi-Fi direct communication; and establish a connection for the Wi-Fi direct communication with one of the candidate electronic devices by using the stored Wi-Fi direct connection information.