Service Discovery with Linux WiFi P2P to Android WiFi P2P Connection

I’m trying to add a local service from android like below:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>val record: Map<String, String> = mapOf(
"buddyname" to "John Doe${(Math.random() * 1000).toInt()}",
"available" to "visible"
)
val serviceInfo = WifiP2pDnsSdServiceInfo.newInstance("android","app",record)
mManager.addLocalService(mChannel,serviceInfo,actionListener)
</code>
<code>val record: Map<String, String> = mapOf( "buddyname" to "John Doe${(Math.random() * 1000).toInt()}", "available" to "visible" ) val serviceInfo = WifiP2pDnsSdServiceInfo.newInstance("android","app",record) mManager.addLocalService(mChannel,serviceInfo,actionListener) </code>
val record: Map<String, String> = mapOf(
    "buddyname" to "John Doe${(Math.random() * 1000).toInt()}",
    "available" to "visible"
)

val serviceInfo  = WifiP2pDnsSdServiceInfo.newInstance("android","app",record)
 mManager.addLocalService(mChannel,serviceInfo,actionListener)

And trying to discover the service from wpa_cli in (RASPBERRY PI OS) linux using the below command:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>p2p_serv_disc_req 00:00:00:00:00:00 02000001
</code>
<code>p2p_serv_disc_req 00:00:00:00:00:00 02000001 </code>
p2p_serv_disc_req 00:00:00:00:00:00 02000001

Response:
5f9…(Some Identifier for Request)

But this returns a identifier that can be used to cancel the request. I’ve seen online in the examples wpa_cli returns events showing the response for the request. I’ve tried control sockets with python but still receiving the same response.

I want to receive the service advertised in android in the linux ideally from a python script.

Both the devices are able to discover each other, Correct me if I’m wrong but I’m assuming the there is no prior connection required to fetch the available services for WiFi Direct.

Thank you in advance.
Any help is appreciated.

Attaching Python Script:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import os
import select
import socket
interface = "wlan0"
wpa_send_path = "/run/wpa_supplicant/"+interface
wpa_recv_path = "/tmp/wpa_ctrl_{pid}-{count}".format(pid=os.getpid(), count=1)
soc = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM, 0)
soc.bind(wpa_recv_path)
soc.connect(wpa_send_path)
soc.send(b"ATTACH")
print("> P2P FIND")
soc.send(b"P2P_FIND")
# Start receiving events
message_count = 0
while message_count < 5:
print("<", soc.recv(4096).decode().strip())
print("> P2P ")
soc.send(b"P2P_SERV_DISC_REQ ce:9f:7a:92:98:60 02000001")
message_count += 1
print("> DEATTACH")
soc.send(b"DEATTACH")
print("<", soc.recv(4096).decode().strip())
</code>
<code>import os import select import socket interface = "wlan0" wpa_send_path = "/run/wpa_supplicant/"+interface wpa_recv_path = "/tmp/wpa_ctrl_{pid}-{count}".format(pid=os.getpid(), count=1) soc = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM, 0) soc.bind(wpa_recv_path) soc.connect(wpa_send_path) soc.send(b"ATTACH") print("> P2P FIND") soc.send(b"P2P_FIND") # Start receiving events message_count = 0 while message_count < 5: print("<", soc.recv(4096).decode().strip()) print("> P2P ") soc.send(b"P2P_SERV_DISC_REQ ce:9f:7a:92:98:60 02000001") message_count += 1 print("> DEATTACH") soc.send(b"DEATTACH") print("<", soc.recv(4096).decode().strip()) </code>
import os
import select
import socket

interface = "wlan0"
wpa_send_path = "/run/wpa_supplicant/"+interface
wpa_recv_path = "/tmp/wpa_ctrl_{pid}-{count}".format(pid=os.getpid(), count=1)

soc = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM, 0)
soc.bind(wpa_recv_path)
soc.connect(wpa_send_path)
soc.send(b"ATTACH")

print("> P2P FIND")
soc.send(b"P2P_FIND")
# Start receiving events
message_count = 0
while message_count < 5:
    print("<", soc.recv(4096).decode().strip())
    print("> P2P ")
    soc.send(b"P2P_SERV_DISC_REQ ce:9f:7a:92:98:60 02000001")
    message_count += 1
print("> DEATTACH")
soc.send(b"DEATTACH")
print("<", soc.recv(4096).decode().strip())

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật