Skip to content

Commit e7c457e

Browse files
committed
Support creating raw ICMP sockets
1 parent b2d9a1b commit e7c457e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Socket/React/Datagram/Factory.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
namespace Socket\React\Datagram;
44

5+
56
use Socket\React\SelectPoller;
67
use React\Promise\When;
78
use React\Promise\Deferred;
89
use React\EventLoop\LoopInterface;
910
use Socket\Raw\Factory as RawFactory;
11+
use Socket\Raw\Socket as RawSocket;
1012
use \Exception;
1113

1214
class Factory
@@ -95,6 +97,21 @@ public function createUdg()
9597
return new Datagram($this->rawFactory->createUdg(), $this->getPoller());
9698
}
9799

100+
public function createIcmp4()
101+
{
102+
return $this->createFromRaw($this->rawFactory->createIcmp4());
103+
}
104+
105+
public function createIcmp6()
106+
{
107+
return $this->createFromRaw($this->rawFactory->createIcmp4());
108+
}
109+
110+
public function createFromRaw(RawSocket $rawSocket)
111+
{
112+
return new Datagram($rawSocket, $this->getPoller());
113+
}
114+
98115
/**
99116
*
100117
* @return SelectPoller

0 commit comments

Comments
 (0)