|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.net.DatagramSocket
public class DatagramSocket
JControl UDP Socket Implementation This class represents a socket for sending and receiving datagram packets. A datagram socket is the sending or receiving point for a packet delivery service. Each packet sent or received on a datagram socket is individually addressed and routed. Multiple packets sent from one machine to another may be routed differently, and may arrive in any order. UDP broadcasts sends are always enabled on a DatagramSocket. In order to receive broadcast packets a DatagramSocket should be bound to the wildcard address. In some implementations, broadcast packets may also be received when a DatagramSocket is bound to a more specific address.
Method Summary | |
---|---|
void |
close()
Closes this UDP socket |
static DatagramSocket |
create(int port)
Creates a new UDP socket by overgiven port-number on the local machine. |
protected void |
finalize()
Free internal data structures used by this datagramsocket object. |
int |
getLocalPort()
Returns the port number on the local host to which this socket is bound. |
void |
receive(DatagramPacket p)
Receives a datagram packet from this socket. |
void |
send(DatagramPacket p)
Sends a datagram packet from this socket. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Method Detail |
---|
public int getLocalPort()
public static DatagramSocket create(int port) throws IOException
port
- local port number
IOException
- if error occuredpublic void send(DatagramPacket p) throws IOException
p
- DatagramPacket contains target UDP header informations and data to send.
IOException
- if error occuredpublic void receive(DatagramPacket p) throws IOException
p
- DatagramPacket to store the received UDP header informations and data.
IOException
- if error occuredpublic void close() throws IOException
IOException
- if error occured or DatagramSocket always closedprotected void finalize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |