Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.net

Class PlainDatagramSocketImpl

java.lang.Object
|
+--java.net.DatagramSocketImpl
   |
   +--java.net.PlainDatagramSocketImpl


public class PlainDatagramSocketImpl

extends DatagramSocketImpl

This is the default socket implementation for datagram sockets. It makes native calls to C routines that implement BSD style SOCK_DGRAM sockets in the AF_INET family.

Author:

Field Summary

intnative_fd

This is the actual underlying file descriptor

Constructor Summary

PlainDatagramSocketImpl()

Default do nothing constructor

Method Summary

synchronized voidbind(int port, java.net.InetAddress addr)

Binds this socket to a particular port and interface
synchronized voidclose()

Closes the socket
synchronized voidcreate()

Creates a new datagram socket
synchronized java.lang.ObjectgetOption(int option_id)

Retrieves the value of an option on the socket
synchronized bytegetTTL()

Gets the Time to Live value for the socket
synchronized intgetTimeToLive()

Gets the Time to Live value for the socket
synchronized voidjoin(java.net.InetAddress addr)

Joins a multicast group
voidjoinGroup(java.net.SocketAddress address, java.net.NetworkInterface netIf)

synchronized voidleave(java.net.InetAddress addr)

Leaves a multicast group
voidleaveGroup(java.net.SocketAddress address, java.net.NetworkInterface netIf)

synchronized intpeek(java.net.InetAddress addr)

What does this method really do?
intpeekData(java.net.DatagramPacket packet)

synchronized voidreceive(java.net.DatagramPacket packet)

Receives a UDP packet from the network
synchronized voidsend(java.net.DatagramPacket packet)

Sends a packet of data to a remote host
synchronized voidsetOption(int option_id, java.lang.Object val)

Sets the value of an option on the socket
synchronized voidsetTTL(byte ttl)

Sets the Time to Live value for the socket
synchronized voidsetTimeToLive(int ttl)

Sets the Time to Live value for the socket

Field Details

native_fd

protected int native_fd

This is the actual underlying file descriptor


Constructor Details

PlainDatagramSocketImpl

public PlainDatagramSocketImpl()

Default do nothing constructor


Method Details

bind

protected native synchronized void bind(int port, java.net.InetAddress addr)

Binds this socket to a particular port and interface

Parameters:

Throws:


close

protected native synchronized void close()

Closes the socket


create

protected native synchronized void create()

Creates a new datagram socket

Throws:


getOption

public native synchronized Object getOption(int option_id)

Retrieves the value of an option on the socket

Parameters:

Returns:

Throws:


getTTL

protected synchronized byte getTTL()

Gets the Time to Live value for the socket

Returns:

Throws:


getTimeToLive

protected synchronized int getTimeToLive()

Gets the Time to Live value for the socket

Returns:

Throws:


join

protected native synchronized void join(java.net.InetAddress addr)

Joins a multicast group

Parameters:

Throws:


joinGroup

public void joinGroup(java.net.SocketAddress address, java.net.NetworkInterface netIf)

Parameters:


leave

protected native synchronized void leave(java.net.InetAddress addr)

Leaves a multicast group

Parameters:

Throws:


leaveGroup

public void leaveGroup(java.net.SocketAddress address, java.net.NetworkInterface netIf)

Parameters:


peek

protected synchronized int peek(java.net.InetAddress addr)

What does this method really do?

Parameters:


peekData

public int peekData(java.net.DatagramPacket packet)

Parameters:


receive

protected native synchronized void receive(java.net.DatagramPacket packet)

Receives a UDP packet from the network

Parameters:

Throws:


send

protected synchronized void send(java.net.DatagramPacket packet)

Sends a packet of data to a remote host

Parameters:

Throws:


setOption

public native synchronized void setOption(int option_id, java.lang.Object val)

Sets the value of an option on the socket

Parameters:

Throws:


setTTL

protected synchronized void setTTL(byte ttl)

Sets the Time to Live value for the socket

Parameters:

Throws:


setTimeToLive

protected synchronized void setTimeToLive(int ttl)

Sets the Time to Live value for the socket

Parameters:

Throws: