VOOZH about

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

⇱ java.net.ProtocolFamily Class in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

java.net.ProtocolFamily Class in Java

Last Updated : 16 Nov, 2021

ProtocolFamily is a java Interface. The java.net.ProtocolFamily represents a family of communication protocols. Java.net.StandardProtocolFamily implements ProtocolFamily Interface.

public interface ProtocolFamily 

Methods of java.net.ProtocolFamily

java.net.ProtocolFamily interface contains only one method:

S.No.        Method                                         Description                                                                   Return Type                                      
1.name()name() method returns the name of the protocol familyString

Use of ProtocolFamily Interface

S.No.Package      Modifier and TypeName                                                                                              Description
1.java.netclassStandardProtocolFamilyStandardProtocolFamily class defines the standard families of communication protocols.
2.java.nio.channelsstatic DatagramChannel DatagramChannel.open(ProtocolFamily family)DatagramChannel.open() static method opens a datagram channel.
3.java.nio.channels.spiabstract DatagramChannelSelectorProvider.openDatagramChannel( ProtocolFamily family)SelectorProvider.openDatagramChannel Opens a datagram channel.

Java Program for Better Understanding of the ProtocolFamily Interface


Output
Host Name is 45.22.30.39
Protocol family of the 45.22.30.39 is INET
Comment
Article Tags: