net.dhcp
Class DHCPSocket

java.lang.Object
  extended by java.net.DatagramSocket
      extended by net.dhcp.DHCPSocket

public class DHCPSocket
extends java.net.DatagramSocket

This class represents a Socket for sending DHCP Messages

Version:
1.1.1 9/06/1999
Author:
Jason Goldschmidt
See Also:
DatagramSocket

Constructor Summary
DHCPSocket(int inPort)
          Constructor for creating DHCPSocket on a specific port on the local machine.
 
Method Summary
 int getMTU()
          Returns the set MTU for this socket
 boolean receive(DHCPMessage outMessage)
          Receives a datagram packet containing a DHCP Message into a DHCPMessage object.
 void send(DHCPMessage inMessage)
          Sends a DHCPMessage object to a predifined host.
 void setMTU(int inSize)
          Sets the Maximum Transfer Unit for the UDP DHCP Packets to be set.
 
Methods inherited from class java.net.DatagramSocket
bind, close, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, receive, send, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DHCPSocket

public DHCPSocket(int inPort)
           throws java.net.SocketException
Constructor for creating DHCPSocket on a specific port on the local machine.

Parameters:
inPort - the port for the application to bind.
Throws:
java.net.SocketException
Method Detail

setMTU

public void setMTU(int inSize)
Sets the Maximum Transfer Unit for the UDP DHCP Packets to be set. Default is 1500, MTU for Ethernet

Parameters:
inSize - integer representing desired MTU

getMTU

public int getMTU()
Returns the set MTU for this socket

Returns:
the Maximum Transfer Unit set for this socket

send

public void send(DHCPMessage inMessage)
          throws java.io.IOException
Sends a DHCPMessage object to a predifined host.

Parameters:
inMessage - well-formed DHCPMessage to be sent to a server
Throws:
java.io.IOException

receive

public boolean receive(DHCPMessage outMessage)
Receives a datagram packet containing a DHCP Message into a DHCPMessage object.

Parameters:
outMessage - DHCPMessage object to receive new message into
Returns:
true if message is received, false if timeout occurs.