Source Code Cross Referenced for IConnection.java in  » Web-Server » xsocket » org » xsocket » connection » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » xsocket » org.xsocket.connection 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright (c) xsocket.org, 2006 - 2008. All rights reserved.
003:         *
004:         *  This library is free software; you can redistribute it and/or
005:         *  modify it under the terms of the GNU Lesser General Public
006:         *  License as published by the Free Software Foundation; either
007:         *  version 2.1 of the License, or (at your option) any later version.
008:         *
009:         *  This library is distributed in the hope that it will be useful,
010:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         *  Lesser General Public License for more details.
013:         *
014:         *  You should have received a copy of the GNU Lesser General Public
015:         *  License along with this library; if not, write to the Free Software
016:         *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         *
018:         * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
019:         * The latest copy of this software may be found on http://www.xsocket.org/
020:         */
021:        package org.xsocket.connection;
022:
023:        import java.io.Closeable;
024:        import java.io.IOException;
025:        import java.net.InetAddress;
026:
027:        /**
028:         * A connection (session) between two endpoints. It encapsulates the underlying socket channel. <br><br>
029:         *
030:         *
031:         * @author grro@xsocket.org
032:         */
033:        public interface IConnection extends Closeable {
034:
035:            public static final String INITIAL_DEFAULT_ENCODING = "UTF-8";
036:
037:            public static final String SO_SNDBUF = "SOL_SOCKET.SO_SNDBUF";
038:            public static final String SO_RCVBUF = "SOL_SOCKET.SO_RCVBUF";
039:            public static final String SO_REUSEADDR = "SOL_SOCKET.SO_REUSEADDR";
040:            public static final String SO_KEEPALIVE = "SOL_SOCKET.SO_KEEPALIVE";
041:            public static final String SO_LINGER = "SOL_SOCKET.SO_LINGER";
042:            public static final String TCP_NODELAY = "IPPROTO_TCP.TCP_NODELAY";
043:            static final String SO_TIMEOUT = "SOL_SOCKET.SO_TIMEOUT";
044:
045:            public static final long MAX_TIMEOUT_MILLIS = Long.MAX_VALUE;
046:            public static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = MAX_TIMEOUT_MILLIS;
047:            public static final long DEFAULT_IDLE_TIMEOUT_MILLIS = MAX_TIMEOUT_MILLIS;
048:
049:            public enum FlushMode {
050:                SYNC, ASYNC
051:            };
052:
053:            public static final FlushMode DEFAULT_FLUSH_MODE = FlushMode.SYNC;
054:            public static final boolean DEFAULT_AUTOFLUSH = true;
055:
056:            /**
057:             * returns the id
058:             *
059:             * @return id
060:             */
061:            public String getId();
062:
063:            /**
064:             * returns, if the connection is open. <br><br>
065:             *
066:             * Please note, that a connection could be closed, but reading of already
067:             * received (and internally buffered) data would not fail. See also
068:             * {@link IDataHandler#onData(INonBlockingConnection)}
069:             *
070:             *
071:             * @return true if the connection is open
072:             */
073:            public boolean isOpen();
074:
075:            /**
076:             * returns the local port
077:             *
078:             * @return the local port
079:             */
080:            public int getLocalPort();
081:
082:            /**
083:             * returns the local address
084:             *
085:             * @return the local IP address or InetAddress.anyLocalAddress() if the socket is not bound yet.
086:             */
087:            public InetAddress getLocalAddress();
088:
089:            /**
090:             * returns the remote address
091:             *
092:             * @return the remote address
093:             */
094:            public InetAddress getRemoteAddress();
095:
096:            /**
097:             * returns the port of the remote end point
098:             *
099:             * @return the remote port
100:             */
101:            public int getRemotePort();
102:
103:            /**
104:             * returns the idle timeout in millis.
105:             *
106:             * @return idle timeout in millis
107:             */
108:            public long getIdleTimeoutMillis();
109:
110:            /**
111:             * sets the idle timeout in millis
112:             *
113:             * @param timeoutInSec idle timeout in millis
114:             */
115:            public void setIdleTimeoutMillis(long timeoutInMillis);
116:
117:            /**
118:             * gets the connection timeout
119:             *
120:             * @return connection timeout
121:             */
122:            public long getConnectionTimeoutMillis();
123:
124:            /**
125:             * sets the max time for a connections. By
126:             * exceeding this time the connection will be
127:             * terminated
128:             *
129:             * @param timeoutSec the connection timeout in millis
130:             */
131:            public void setConnectionTimeoutMillis(long timeoutMillis);
132:
133:            /**
134:             * returns the remaining time before a idle timeout occurs 
135:             *
136:             * @return the remaining time 
137:             */
138:            public long getRemainingMillisToIdleTimeout();
139:
140:            /**
141:             * returns the remaining time before a connection timeout occurs 
142:             *
143:             * @return the remaining time 
144:             */
145:            public long getRemainingMillisToConnectionTimeout();
146:
147:            /**
148:             * sets the value of a option. <br><br>
149:             *
150:             * A good article for tuning can be found here {@link http://www.onlamp.com/lpt/a/6324}
151:             *
152:             * @param name   the name of the option
153:             * @param value  the value of the option
154:             * @throws IOException In an I/O error occurs
155:             */
156:            public void setOption(String name, Object value) throws IOException;
157:
158:            /**
159:             * returns the value of a option
160:             *
161:             * @param name  the name of the option
162:             * @return the value of the option
163:             * @throws IOException In an I/O error occurs
164:             */
165:            public Object getOption(String name) throws IOException;
166:
167:            /**
168:             * Returns an unmodifiable map of the options supported by this end point.
169:             *
170:             * The key in the returned map is the name of a option, and its value
171:             * is the type of the option value. The returned map will never contain null keys or values.
172:             *
173:             * @return An unmodifiable map of the options supported by this channel
174:             */
175:            @SuppressWarnings("unchecked")
176:            public java.util.Map<String, Class> getOptions();
177:
178:            /**
179:             * Attaches the given object to this connection
180:             *
181:             * @param obj The object to be attached; may be null
182:             * @return The previously-attached object, if any, otherwise null
183:             */
184:            public void setAttachment(Object obj);
185:
186:            /**
187:             * Retrieves the current attachment.
188:             *
189:             * @return The object currently attached to this key, or null if there is no attachment
190:             */
191:            public Object getAttachment();
192:
193:            /**
194:             * returns if the connection is in secured mode
195:             * @return true, if the connection is in secured mode
196:             */
197:            public boolean isSecure();
198:
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.