ed3975cad633ebd9027fe17cdd87e0f65f12b8fa
2 * Jexer - Java Text User Interface
4 * License: LGPLv3 or later
6 * This module is licensed under the GNU Lesser General Public License
7 * Version 3. Please see the file "COPYING" in this directory for more
8 * information about the GNU Lesser General Public License Version 3.
10 * Copyright (C) 2015 Kevin Lamonte
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 3 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this program; if not, see
24 * http://www.gnu.org/licenses/, or write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
33 import java
.io
.InputStream
;
34 import java
.io
.IOException
;
35 import java
.io
.OutputStream
;
36 import java
.net
.InetAddress
;
37 import java
.net
.ServerSocket
;
38 import java
.net
.Socket
;
41 * This class provides a ServerSocket that return TelnetSocket's in accept().
43 public final class TelnetServerSocket
extends ServerSocket
{
45 // ServerSocket interface -------------------------------------------------
48 * Creates an unbound server socket.
50 public TelnetServerSocket() throws IOException
{
55 * Creates a server socket, bound to the specified port.
57 public TelnetServerSocket(final int port
) throws IOException
{
62 * Creates a server socket and binds it to the specified local port
63 * number, with the specified backlog.
65 public TelnetServerSocket(final int port
,
66 final int backlog
) throws IOException
{
72 * Create a server with the specified port, listen backlog, and local IP
75 public TelnetServerSocket(final int port
, final int backlog
,
76 final InetAddress bindAddr
) throws IOException
{
78 super(port
, backlog
, bindAddr
);
82 * Listens for a connection to be made to this socket and accepts it. The
83 * method blocks until a connection is made.
86 public Socket
accept() throws IOException
{
87 Socket socket
= super.accept();
88 return new TelnetSocket(socket
);