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;
022import org.jgrapes.io.IOSubchannel;
023
024/**
025 * A special sub channel used for TCP connections.
026 */
027public interface TcpChannel extends IOSubchannel {
028
029    /**
030     * Returns the local address.
031     *
032     * @return the socket address
033     */
034    SocketAddress localAddress();
035
036    /**
037     * Returns the remote address.
038     *
039     * @return the socket address
040     */
041    SocketAddress remoteAddress();
042
043    /**
044     * Checks if the connection is purgeable.
045     *
046     * @return true, if is purgeable
047     */
048    boolean isPurgeable();
049
050    /**
051     * Returns since when the connection has become purgeable.
052     *
053     * @return the timestamp
054     */
055    long purgeableSince();
056}