Source Code Cross Referenced for DefaultSocketFactory.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » 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 » Net » Apache commons net 1.4.1 » org.apache.commons.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2005 The Apache Software Foundation
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.apache.commons.net;
017:
018:        import java.io.IOException;
019:        import java.net.InetAddress;
020:        import java.net.ServerSocket;
021:        import java.net.Socket;
022:        import java.net.UnknownHostException;
023:
024:        /***
025:         * DefaultSocketFactory implements the SocketFactory interface by
026:         * simply wrapping the java.net.Socket and java.net.ServerSocket
027:         * constructors.  It is the default SocketFactory used by
028:         * {@link org.apache.commons.net.SocketClient}
029:         * implementations.
030:         * <p>
031:         * <p>
032:         * @author Daniel F. Savarese
033:         * @see SocketFactory
034:         * @see SocketClient
035:         * @see SocketClient#setSocketFactory
036:         ***/
037:
038:        public class DefaultSocketFactory implements  SocketFactory {
039:
040:            /***
041:             * Creates a Socket connected to the given host and port.
042:             * <p>
043:             * @param host The hostname to connect to.
044:             * @param port The port to connect to.
045:             * @return A Socket connected to the given host and port.
046:             * @exception UnknownHostException  If the hostname cannot be resolved.
047:             * @exception IOException If an I/O error occurs while creating the Socket.
048:             ***/
049:            public Socket createSocket(String host, int port)
050:                    throws UnknownHostException, IOException {
051:                return new Socket(host, port);
052:            }
053:
054:            /***
055:             * Creates a Socket connected to the given host and port.
056:             * <p>
057:             * @param address The address of the host to connect to.
058:             * @param port The port to connect to.
059:             * @return A Socket connected to the given host and port.
060:             * @exception IOException If an I/O error occurs while creating the Socket.
061:             ***/
062:            public Socket createSocket(InetAddress address, int port)
063:                    throws IOException {
064:                return new Socket(address, port);
065:            }
066:
067:            /***
068:             * Creates a Socket connected to the given host and port and
069:             * originating from the specified local address and port.
070:             * <p>
071:             * @param host The hostname to connect to.
072:             * @param port The port to connect to.
073:             * @param localAddr  The local address to use.
074:             * @param localPort  The local port to use.
075:             * @return A Socket connected to the given host and port.
076:             * @exception UnknownHostException  If the hostname cannot be resolved.
077:             * @exception IOException If an I/O error occurs while creating the Socket.
078:             ***/
079:            public Socket createSocket(String host, int port,
080:                    InetAddress localAddr, int localPort)
081:                    throws UnknownHostException, IOException {
082:                return new Socket(host, port, localAddr, localPort);
083:            }
084:
085:            /***
086:             * Creates a Socket connected to the given host and port and
087:             * originating from the specified local address and port.
088:             * <p>
089:             * @param address The address of the host to connect to.
090:             * @param port The port to connect to.
091:             * @param localAddr  The local address to use.
092:             * @param localPort  The local port to use.
093:             * @return A Socket connected to the given host and port.
094:             * @exception IOException If an I/O error occurs while creating the Socket.
095:             ***/
096:            public Socket createSocket(InetAddress address, int port,
097:                    InetAddress localAddr, int localPort) throws IOException {
098:                return new Socket(address, port, localAddr, localPort);
099:            }
100:
101:            /***
102:             * Creates a ServerSocket bound to a specified port.  A port
103:             * of 0 will create the ServerSocket on a system-determined free port.
104:             * <p>
105:             * @param port  The port on which to listen, or 0 to use any free port.
106:             * @return A ServerSocket that will listen on a specified port.
107:             * @exception IOException If an I/O error occurs while creating
108:             *                        the ServerSocket.
109:             ***/
110:            public ServerSocket createServerSocket(int port) throws IOException {
111:                return new ServerSocket(port);
112:            }
113:
114:            /***
115:             * Creates a ServerSocket bound to a specified port with a given
116:             * maximum queue length for incoming connections.  A port of 0 will
117:             * create the ServerSocket on a system-determined free port.
118:             * <p>
119:             * @param port  The port on which to listen, or 0 to use any free port.
120:             * @param backlog  The maximum length of the queue for incoming connections.
121:             * @return A ServerSocket that will listen on a specified port.
122:             * @exception IOException If an I/O error occurs while creating
123:             *                        the ServerSocket.
124:             ***/
125:            public ServerSocket createServerSocket(int port, int backlog)
126:                    throws IOException {
127:                return new ServerSocket(port, backlog);
128:            }
129:
130:            /***
131:             * Creates a ServerSocket bound to a specified port on a given local
132:             * address with a given maximum queue length for incoming connections.
133:             * A port of 0 will
134:             * create the ServerSocket on a system-determined free port.
135:             * <p>
136:             * @param port  The port on which to listen, or 0 to use any free port.
137:             * @param backlog  The maximum length of the queue for incoming connections.
138:             * @param bindAddr  The local address to which the ServerSocket should bind.
139:             * @return A ServerSocket that will listen on a specified port.
140:             * @exception IOException If an I/O error occurs while creating
141:             *                        the ServerSocket.
142:             ***/
143:            public ServerSocket createServerSocket(int port, int backlog,
144:                    InetAddress bindAddr) throws IOException {
145:                return new ServerSocket(port, backlog, bindAddr);
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.