VOOZH about

URL: https://www.geeksforgeeks.org/java/java-net-socketimplfactory-class-in-java/

⇱ java.net.SocketImplFactory Class in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

java.net.SocketImplFactory Class in Java

Last Updated : 29 Mar, 2023

In Java, SocketImplFactory Class is an interface java.net.SocketImplFactory Class is defining a factory for SocketImpl instances, as this interface is usable by sockets classes to create the sockets execution that implements various policies through it. Interface java.net.SocketImplFactory Class is defining the factory for setting the socketing executions. It uses classes as Socket and ServerSocket to create to its current socket executions on it.

--> java.net Package
 --> SocketImplFactory Class  

java.net is one of package that use SocketImplFactory in providing the classes for executing on its networking applications. 

Method of SocketImplFactory Class

MethodAction Performed
createSocketImpl()Creating an new SocketImpl instances on it

Uses of SocketImplFactory Class in java.net package 

MethodAction Performed
ServerSocket.setSocketFactory(SocketImplFactory fac)Setting up an server socketing execution on factories of the application. Using an ServerSocketFactory and its subclass to ServerSocket directly.
Socket.setSocketImplFactory(SocketImplFactory fac)Setting up an client socketing executions factories of its application. Using an SocketFactory and its subclass to Socket directly.

Example 1:


Output: 

👁 Image
 

Example 2:

Output:

👁 Image
 

Note: In above two code we are only emphasizing on eccentric concept so do not look for the start point of execution of code as main() method is not inserted over here.  

Comment
Article Tags:
Article Tags: