1 | <?php |
||
20 | class UdpClientSocket implements SocketInterface, WithoutConnectionInterface |
||
21 | { |
||
22 | /** |
||
23 | * Original server socket |
||
24 | * |
||
25 | * @var SocketInterface |
||
26 | */ |
||
27 | private $origin; |
||
28 | |||
29 | /** |
||
30 | * I/O interface |
||
31 | * |
||
32 | * @var IoInterface |
||
33 | */ |
||
34 | private $ioInterface; |
||
35 | |||
36 | /** |
||
37 | * Socket context |
||
38 | * |
||
39 | * @var Context |
||
40 | */ |
||
41 | private $context; |
||
42 | |||
43 | /** |
||
44 | * UdpClientSocket constructor. |
||
45 | * |
||
46 | * @param SocketInterface $origin Original server socket |
||
47 | * @param string $remoteAddress Client address |
||
48 | * @param string $data Data for this client |
||
49 | */ |
||
50 | 9 | public function __construct(SocketInterface $origin, $remoteAddress, $data) |
|
51 | { |
||
52 | 9 | $this->origin = $origin; |
|
53 | 9 | $this->ioInterface = new DatagramMemorizedIo($this, $remoteAddress, $data); |
|
54 | 9 | $this->context = new Context(); |
|
55 | 9 | } |
|
56 | |||
57 | /** {@inheritdoc} */ |
||
58 | 3 | public function open($address, $context = null) |
|
62 | |||
63 | /** {@inheritdoc} */ |
||
64 | 1 | public function close() |
|
68 | |||
69 | /** {@inheritdoc} */ |
||
70 | 1 | public function read(FramePickerInterface $picker, $isOutOfBand = false) |
|
74 | |||
75 | /** {@inheritdoc} */ |
||
76 | 1 | public function write($data, $isOutOfBand = false) |
|
80 | |||
81 | /** {@inheritdoc} */ |
||
82 | 4 | public function getStreamResource() |
|
86 | |||
87 | /** |
||
88 | * @inheritDoc |
||
89 | */ |
||
90 | 1 | public function __toString() |
|
94 | } |
||
95 |