1 22 package org.xsocket.datagram; 23 24 import java.io.IOException ; 25 import java.net.InetAddress ; 26 import java.util.HashMap ; 27 import java.util.Map ; 28 import java.util.concurrent.Executor ; 29 30 31 32 33 38 public final class Endpoint extends AbstractChannelBasedEndpoint implements IEndpoint { 39 40 41 49 public Endpoint() throws IOException { 50 this(0); 51 } 52 53 54 55 64 public Endpoint(int receivePacketSize) throws IOException { 65 this(receivePacketSize, null); 66 } 67 68 69 70 73 public Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize) throws IOException { 74 this(socketConfiguration, receivePacketSize, null, InetAddress.getLocalHost(), 0); 75 } 76 77 78 79 89 public Endpoint(int receivePacketSize, IDatagramHandler datagramHandler) throws IOException { 90 this(new DatagramSocketConfiguration(), receivePacketSize, datagramHandler, InetAddress.getLocalHost(), 0); 91 } 92 93 104 public Endpoint(int receivePacketSize, IDatagramHandler datagramHandler, Executor workerPool) throws IOException { 105 this(new HashMap <String , Object >(), receivePacketSize, datagramHandler, workerPool, InetAddress.getLocalHost(), 0); 106 } 107 108 109 112 public Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize, IDatagramHandler datagramHandler) throws IOException { 113 this(socketConfiguration, receivePacketSize, datagramHandler, InetAddress.getLocalHost(), 0); 114 } 115 116 117 118 119 131 public Endpoint(int receivePacketSize, IDatagramHandler datagramHandler, InetAddress address, int port) throws IOException { 132 this(null, receivePacketSize, datagramHandler, address, port); 133 } 134 135 136 139 public Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize, IDatagramHandler datagramHandler, InetAddress address, int port) throws IOException { 140 this(socketConfiguration, receivePacketSize, datagramHandler, getGlobalWorkerPool(), address, port); 141 } 142 143 144 145 148 public Endpoint(DatagramSocketConfiguration socketConfiguration, int receivePacketSize, IDatagramHandler datagramHandler, Executor workerPool, InetAddress address, int port) throws IOException { 149 this(socketConfiguration.toOptions(), receivePacketSize, datagramHandler, workerPool, address, port); 150 } 151 152 166 public Endpoint(Map <String , Object > options, int receivePacketSize, IDatagramHandler datagramHandler, Executor workerPool, InetAddress address, int port) throws IOException { 167 super(address, port, options, datagramHandler, receivePacketSize, workerPool); 168 } 169 170 171 184 public Endpoint(int receivePacketSize, IDatagramHandler datagramHandler, Executor workerPool, InetAddress address, int port) throws IOException { 185 super(address, port, new HashMap <String , Object >(), datagramHandler, receivePacketSize, workerPool); 186 } 187 188 191 protected Endpoint setOption(String name, Object value) throws IOException { 192 return (Endpoint) super.setOption(name, value); 193 } 194 } 195 | Popular Tags |