com.dalsemi.tininet
Class TINIDatagramSocket
java.lang.Object
|
+--java.net.DatagramSocket
|
+--com.dalsemi.tininet.TINIDatagramSocket
- public class TINIDatagramSocket
- extends DatagramSocket
This subclass of DatagramSocket
is a faster and memory conserving version
of java.net.DatagramSocket
.
TINIDatagramSocket
is a direct drop-in
replacement. The receive()
method is
the only method behaving slightly differently. Unlike
its superclass, TINIDatagramSocket.receive(p)
does not allocate a new InetAddress
object
when the DatagramPacket
p's address
is not null.
Constructor Summary |
TINIDatagramSocket()
Constructs a TINIDatagramSocket and binds
it to any available port on the local host machine. |
TINIDatagramSocket(int port)
Constructs a TINIDatagramSocket and binds
it to the specified port on the local host machine. |
TINIDatagramSocket(int port,
InetAddress laddr)
Constructs a TINIDatagramSocket and binds
it to the specified port and the specified address
on the local host machine. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
TINIDatagramSocket
public TINIDatagramSocket()
throws SocketException
- Constructs a
TINIDatagramSocket
and binds
it to any available port on the local host machine.
- Throws:
- SocketException - if the socket could not be opened, or the
socket bind operation failed.
TINIDatagramSocket
public TINIDatagramSocket(int port)
throws SocketException
- Constructs a
TINIDatagramSocket
and binds
it to the specified port on the local host machine.
- Parameters:
port
- local port to use.- Throws:
- SocketException - if the socket could not be opened, or the
socket could not bind to the specified
local port.
TINIDatagramSocket
public TINIDatagramSocket(int port,
InetAddress laddr)
throws SocketException
- Constructs a
TINIDatagramSocket
and binds
it to the specified port and the specified address
on the local host machine.
- Parameters:
port
- local port to use.laddr
- local address to use.- Throws:
- SocketException - if the socket could not be opened, or the
socket could not bind to the specified
local port and address.