Lines Matching refs:socket

56      * socket and closes it, returning the address of the closed socket. If
84 ServerSocket socket = new ServerSocket(0, 100,
86 RefusingServer server = new RefusingServer(socket.getInetAddress(),
87 socket.getLocalPort());
88 socket.close();
106 private ServerSocket serverSocket; // the server socket
160 * Creates a new server socket.
166 * @return a new bound server socket ready to accept connections.
167 * @throws IOException if the socket cannot be created or bound.
178 * @throws IOException if the server socket cannot be created or bound.
184 final ServerSocket socket =
186 serverSocket = socket;
202 final ServerSocket socket = serverSocket();
203 if (socket != null && !socket.isClosed()) {
235 System.err.println("Failed to close server socket");
252 protected final Socket socket;
254 protected TcpConnectionThread(Socket socket) {
255 this.socket = socket;
260 socket.close();
267 * an accepted socket.
269 * @param s the socket returned by {@code serverSocket.accept()}.
271 * an accepted socket.
277 * socket.
279 * @param s the socket returned by {@code serverSocket.accept()}.
308 * Close the server socket and all the connections present in the list
361 public EchoConnection(Socket socket) {
362 super(socket);
368 final InputStream is = socket.getInputStream();
369 final OutputStream out = socket.getOutputStream();
379 if (!socket.isClosed()) {
381 socket.close();
384 "Failed to close echo connection socket");
437 public DayTimeServerConnection(Socket socket) {
438 super(socket);
444 final OutputStream out = socket.getOutputStream();
452 if (!socket.isClosed()) {
454 socket.close();
457 "Failed to close echo connection socket");
488 private DatagramSocket serverSocket; // the server socket
542 * Creates a new datagram socket.
546 * @return a new bound server socket ready to listen for packets.
547 * @throws IOException if the socket cannot be created or bound.
558 * @throws IOException if the server socket cannot be created or bound.
564 final DatagramSocket socket =
566 serverSocket = socket;
582 final DatagramSocket socket = serverSocket();
583 if (socket != null && !socket.isClosed()) {
594 final synchronized boolean send(DatagramSocket socket,
596 if (!socket.isClosed()) {
597 socket.send(response);
647 protected final DatagramSocket socket;
649 protected UdpRequestThread(DatagramSocket socket, DatagramPacket request) {
650 this.socket = socket;
660 * @param socket the socket through which the request was received.
661 * @param request the datagram packet received through the socket.
665 protected abstract UdpRequestThread createConnection(DatagramSocket socket,
672 * @param socket the socket through which the request was received.
673 * @param request the datagram packet received through the socket.
675 private synchronized void handle(DatagramSocket socket,
677 UdpRequestThread c = createConnection(socket, request);
685 * Close the server socket.
718 protected UdpRequestThread createConnection(DatagramSocket socket,
753 protected UdpEchoRequest createConnection(DatagramSocket socket,
755 return new UdpEchoRequest(socket, request);
760 public UdpEchoRequest(DatagramSocket socket, DatagramPacket request) {
761 super(socket, request);
772 send(socket, response);
809 protected UdpDayTimeRequestThread createConnection(DatagramSocket socket,
811 return new UdpDayTimeRequestThread(socket, request);
816 public UdpDayTimeRequestThread(DatagramSocket socket,
818 super(socket, request);
830 send(socket, response);