public class DHCPSocket extends DatagramSocket
DatagramSocket| Constructor and Description |
|---|
DHCPSocket(int inPort)
Constructor for creating DHCPSocket on a specific port on the local
machine.
|
DHCPSocket(int inPort,
InetAddress lAddr)
Constructor for creating DHCPSocket on a specific local address and port
on the local machine.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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, setTrafficClasspublic DHCPSocket(int inPort)
throws SocketException
inPort - The port for the application to bind.SocketException - As thrown by the Socket constructorpublic DHCPSocket(int inPort,
InetAddress lAddr)
throws SocketException
inPort - The port for the application to bind.lAddr - The local address for the application to bind.SocketException - As thrown by the Socket constructorpublic void setMTU(int inSize)
inSize - Integer representing desired MTUpublic int getMTU()
public void send(DHCPMessage inMessage) throws IOException
inMessage - Well-formed DHCPMessage to be sent to a serverIOException - If the message could not be sent.public boolean receive(DHCPMessage outMessage)
outMessage - DHCPMessage object to receive new message intotrue if message is received, false if
timeout occurs.Copyright © 2020. All rights reserved.