Skip to content

Commit 9b17f1a

Browse files
committed
feat: add binding for ping method in RakPeer
1 parent 8804956 commit 9b17f1a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

python/raknet/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class RakPeer:
8989
...
9090
def get_bound_address(self, index: int = 0) -> SystemAddress:
9191
...
92+
def ping(self, host: str, port: int, only_reply_on_accepting_connections: bool = False) -> bool:
93+
...
9294
def receive(self) -> Packet:
9395
...
9496
def send(self, data: bytes, priority: PacketPriority, reliability: PacketReliability, ordering_channel: int, address: SystemAddress, force_receipt_num: int = 0) -> int:

src/raknet_python.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ PYBIND11_MODULE(raknet_python, m) {
246246
py::arg("ordering_channel") = 0,
247247
py::arg("disconnection_notification_priority") = PacketPriority::LOW_PRIORITY)
248248

249+
.def(
250+
"ping",
251+
[](RakNet::RakPeerInterface &self, const std::string &host, unsigned short port, bool flag) {
252+
return self.Ping(host.c_str(), port, flag);
253+
},
254+
py::arg("host"),
255+
py::arg("port"),
256+
py::arg("only_reply_on_accepting_connections") = false)
257+
249258
.def("get_bound_address", &RakNet::RakPeerInterface::GetMyBoundAddress, py::arg("index") = 0)
250259

251260
.def_property_readonly("active", &RakNet::RakPeerInterface::IsActive)

0 commit comments

Comments
 (0)