1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.channel.unix;
17
18 import io.netty5.buffer.api.WritableComponent;
19 import io.netty5.buffer.api.WritableComponentProcessor;
20 import io.netty5.util.internal.UnstableApi;
21
22 import java.io.IOException;
23
24
25
26
27
28
29 @UnstableApi
30 public final class RecvFromAddressDomainSocket implements WritableComponentProcessor<IOException> {
31 private final Socket socket;
32 private DomainDatagramSocketAddress remoteAddress;
33
34 public RecvFromAddressDomainSocket(Socket socket) {
35 this.socket = socket;
36 }
37
38 @Override
39 public boolean process(int index, WritableComponent component) throws IOException {
40 remoteAddress = socket.recvFromAddressDomainSocket(
41 component.writableNativeAddress(), 0, component.writableBytes());
42 return false;
43 }
44
45 public DomainDatagramSocketAddress remoteAddress() {
46 return remoteAddress;
47 }
48 }