001/*
002 * Ad Hoc Polling Application
003 * Copyright (C) 2018 Michael N. Lipp
004 * 
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU General Public License as published by 
007 * the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 * 
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
013 * for more details.
014 * 
015 * You should have received a copy of the GNU General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jgrapes.net;
020
021import java.net.SocketAddress;
022
023import org.jgrapes.io.IOSubchannel;
024
025/**
026 * A special sub channel used for TCP connections.
027 */
028public interface TcpChannel extends IOSubchannel {
029
030    /**
031     * Returns the local address.
032     *
033     * @return the socket address
034     */
035    SocketAddress localAddress();
036
037    /**
038     * Returns the remote address.
039     *
040     * @return the socket address
041     */
042    SocketAddress remoteAddress();
043
044    /**
045     * Checks if the connection is purgeable.
046     *
047     * @return true, if is purgeable
048     */
049    boolean isPurgeable();
050
051    /**
052     * Returns since when the connection has become purgeable.
053     *
054     * @return the timestamp
055     */
056    long purgeableSince();
057}