API java : DatagramSocketImpl


java.net
Class DatagramSocketImpl

java.lang.Object
  extended by java.net.DatagramSocketImpl
All Implemented Interfaces:
SocketOptions

public abstract class DatagramSocketImpl
extends Object
implements SocketOptions

Abstract datagram and multicast socket implementation base class.

Since:
JDK1.1

Field Summary
protected  FileDescriptor fd
          The file descriptor object.
protected  int localPort
          The local port number.
 
Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
 
Constructor Summary
DatagramSocketImpl()
           
 
Method Summary
protected abstract  void bind(int lport, InetAddress laddr)
          Binds a datagram socket to a local port and address.
protected abstract  void close()
          Close the socket.
protected  void connect(InetAddress address, int port)
          Connects a datagram socket to a remote destination.
protected abstract  void create()
          Creates a datagram socket.
protected  void disconnect()
          Disconnects a datagram socket from its remote destination.
protected  FileDescriptor getFileDescriptor()
          Gets the datagram socket file descriptor.
protected  int getLocalPort()
          Gets the local port.
protected abstract  int getTimeToLive()
          Retrieve the TTL (time-to-live) option.
protected abstract  byte getTTL()
          Deprecated. use getTimeToLive instead.
protected abstract  void join(InetAddress inetaddr)
          Join the multicast group.
protected abstract  void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
          Join the multicast group.
protected abstract  void leave(InetAddress inetaddr)
          Leave the multicast group.
protected abstract  void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
          Leave the multicast group.
protected abstract  int peek(InetAddress i)
          Peek at the packet to see who it is from.
protected abstract  int peekData(DatagramPacket p)
          Peek at the packet to see who it is from.
protected abstract  void receive(DatagramPacket p)
          Receive the datagram packet.
protected abstract  void send(DatagramPacket p)
          Sends a datagram packet.
protected abstract  void setTimeToLive(int ttl)
          Set the TTL (time-to-live) option.
protected abstract  void setTTL(byte ttl)
          Deprecated. use setTimeToLive instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.net.SocketOptions
getOption, setOption
 

Field Detail

localPort

protected int localPort
The local port number.


fd

protected FileDescriptor fd
The file descriptor object.

Constructor Detail

DatagramSocketImpl

public DatagramSocketImpl()
Method Detail

create

protected abstract void create()
                        throws SocketException
Creates a datagram socket.

Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.

bind

protected abstract void bind(int lport,
                             InetAddress laddr)
                      throws SocketException
Binds a datagram socket to a local port and address.

Parameters:
lport - the local port
laddr - the local address
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.

send

protected abstract void send(DatagramPacket p)
                      throws IOException
Sends a datagram packet. The packet contains the data and the destination address to send the packet to.

Parameters:
p - the packet to be sent.
Throws:
IOException - if an I/O exception occurs while sending the datagram packet.
PortUnreachableException - may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.

connect

protected void connect(InetAddress address,
                       int port)
                throws SocketException
Connects a datagram socket to a remote destination. This associates the remote address with the local socket so that datagrams may only be sent to this destination and received from this destination. This may be overridden to call a native system connect.

If the remote destination to which the socket is connected does not exist, or is otherwise unreachable, and if an ICMP destination unreachable packet has been received for that address, then a subsequent call to send or receive may throw a PortUnreachableException. Note, there is no guarantee that the exception will be thrown.

Parameters:
address - the remote InetAddress to connect to
port - the remote port number
Throws:
SocketException - may be thrown if the socket cannot be connected to the remote destination
Since:
1.4

disconnect

protected void disconnect()
Disconnects a datagram socket from its remote destination.

Since:
1.4

peek

protected abstract int peek(InetAddress i)
                     throws IOException
Peek at the packet to see who it is from.

Parameters:
i - an InetAddress object
Returns:
the address which the packet came from.
Throws:
IOException - if an I/O exception occurs
PortUnreachableException - may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.

peekData

protected abstract int peekData(DatagramPacket p)
                         throws IOException
Peek at the packet to see who it is from. The data is returned, but not consumed, so that a subsequent peekData/receive operation will see the same data.

Parameters:
p - the Packet Received.
Returns:
the address which the packet came from.
Throws:
IOException - if an I/O exception occurs
PortUnreachableException - may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.
Since:
1.4

receive

protected abstract void receive(DatagramPacket p)
                         throws IOException
Receive the datagram packet.

Parameters:
p - the Packet Received.
Throws:
IOException - if an I/O exception occurs while receiving the datagram packet.
PortUnreachableException - may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.

setTTL

@Deprecated
protected abstract void setTTL(byte ttl)
                        throws IOException
Deprecated. use setTimeToLive instead.

Set the TTL (time-to-live) option.

Parameters:
ttl - a byte specifying the TTL value
Throws:
IOException - if an I/O exception occurs while setting the time-to-live option.
See Also:
getTTL()

getTTL

@Deprecated
protected abstract byte getTTL()
                        throws IOException
Deprecated. use getTimeToLive instead.

Retrieve the TTL (time-to-live) option.

Returns:
a byte representing the TTL value
Throws:
IOException - if an I/O exception occurs while retrieving the time-to-live option
See Also:
setTTL(byte)

setTimeToLive

protected abstract void setTimeToLive(int ttl)
                               throws IOException
Set the TTL (time-to-live) option.

Parameters:
ttl - an int specifying the time-to-live value
Throws:
IOException - if an I/O exception occurs while setting the time-to-live option.
See Also:
getTimeToLive()

getTimeToLive

protected abstract int getTimeToLive()
                              throws IOException
Retrieve the TTL (time-to-live) option.

Returns:
an int representing the time-to-live value
Throws:
IOException - if an I/O exception occurs while retrieving the time-to-live option
See Also:
setTimeToLive(int)

join

protected abstract void join(InetAddress inetaddr)
                      throws IOException
Join the multicast group.

Parameters:
inetaddr - multicast address to join.
Throws:
IOException - if an I/O exception occurs while joining the multicast group.

leave

protected abstract void leave(InetAddress inetaddr)
                       throws IOException
Leave the multicast group.

Parameters:
inetaddr - multicast address to leave.
Throws:
IOException - if an I/O exception occurs while leaving the multicast group.

joinGroup

protected abstract void joinGroup(SocketAddress mcastaddr,
                                  NetworkInterface netIf)
                           throws IOException
Join the multicast group.

Parameters:
mcastaddr - address to join.
netIf - specifies the local interface to receive multicast datagram packets
Throws:
IOException - if an I/O exception occurs while joining the multicast group
Since:
1.4

leaveGroup

protected abstract void leaveGroup(SocketAddress mcastaddr,
                                   NetworkInterface netIf)
                            throws IOException
Leave the multicast group.

Parameters:
mcastaddr - address to leave.
netIf - specified the local interface to leave the group at
Throws:
IOException - if an I/O exception occurs while leaving the multicast group
Since:
1.4

close

protected abstract void close()
Close the socket.


getLocalPort

protected int getLocalPort()
Gets the local port.

Returns:
an int representing the local port value

getFileDescriptor

protected FileDescriptor getFileDescriptor()
Gets the datagram socket file descriptor.

Returns:
a FileDescriptor object representing the datagram socket file descriptor

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1608
Document créé le 29/08/06 21:32, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-java/net/DatagramSocketImpl.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
1,70 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Pour te donner tous les conseils que je te prodiguais, il a fallu aussi que je me trompe, et cela m'est arrivé souvent.

Marc Levy [Extrait de Et si c'était vrai...]
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 17:34, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)