1 // $Id: IConnectedEndpoint.java 1049 2007-03-21 16:42:48Z grro $ 2 /* 3 * Copyright (c) xsocket.org, 2006. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt 20 * The latest copy of this software may be found on http://www.xsocket.org/ 21 */ 22 package org.xsocket.datagram; 23 24 25 import java.net.SocketAddress; 26 27 28 29 /** 30 * An connected endpoint, which receives/sends data only from/to from the assigned connected endpoint. E.g. 31 * 32 * <pre> 33 * ... 34 * IConnectedEndpoint endpoint = new ConnectedEndpoint(remoteHostname, remotePort, packageSize); 35 * 36 * UserDatagram request = new UserDatagram(packageSize); 37 * request.write("Hello peer, how are you?"); 38 * 39 * endpoint.send(request); 40 * UserDatagram response = endpoint.receive(1000); // receive (timeout 1 sec) 41 * 42 * endpoint.close(); 43 * ... 44 * </pre> 45 * 46 * @author grro@xsocket.org 47 */ 48 public interface IConnectedEndpoint extends IEndpoint { 49 50 51 /** 52 * return the connected remote address or null if not connected 53 * 54 * @return the connected address 55 */ 56 public SocketAddress getRemoteSocketAddress(); 57 } 58