|
Diamond Control Suite 3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component diamondedge.swing.DsSocket
public class DsSocket
DsSocket allows TCP or UDP communication to occur with the data events showing up on the UI event queue in an assynchronous fashion. This allows for an easier mechanism to hook up network communcations to a user interface
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
CLOSE_EVENT
|
static int |
CLOSED
|
static int |
CLOSING
|
static int |
CONNECT_EVENT
|
static int |
CONNECTED
|
static int |
CONNECTING
|
static int |
CONNECTION_PENDING
|
static int |
CONNECTION_REQUEST_EVENT
|
static int |
DATA_ARRIVAL_EVENT
|
static int |
ERROR
|
static int |
ERROR_EVENT
|
static int |
HOST_RESOLVED
|
static int |
LISTENING
|
static int |
OPEN
|
static int |
RESOLVING_HOST
|
static int |
SEND_COMPLETE_EVENT
|
static int |
SEND_PROGRESS_EVENT
|
static int |
TCP_PROTOCOL
|
static int |
UDP_PROTOCOL
|
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DsSocket()
|
Method Summary | |
---|---|
void |
accept()
Accept an incoming connection request |
void |
addSocketListener(SocketListener l)
|
void |
bind(int LocalPort)
Binds socket to specific port and adapter |
void |
close()
Close current connection |
void |
connect()
Connect to the remote computer |
void |
connect(String remoteHostName,
int remotePort)
Connect to the remote computer |
protected static byte[] |
convertToBytes(Variant var)
|
protected static void |
convertToVariant(byte[] b,
Variant var,
int type)
|
int |
getBytesReceived()
Returns the number of bytes received on this connection |
void |
getData(Variant var,
int type)
Retrieve data sent by the remote computer |
String |
getLocalHostName()
Returns the local machine name |
String |
getLocalIP()
Returns the local machine IP address |
int |
getLocalPort()
Returns the port used on the local computer |
int |
getProtocol()
Returns the socket protocol |
InetAddress |
getRemoteHostAddress()
Returns the InetAddress object for the remote computer |
String |
getRemoteHostIP()
Returns the remote host IP address |
String |
getRemoteHostName()
Returns the name used to identify the remote computer |
int |
getRemotePort()
Returns the port to be connected to on the remote computer |
Socket |
getSocket()
Returns the tcp socket object |
int |
getState()
Returns the state of the socket connection |
int |
getUdpBufferLength()
Returns the buffer length used to receive DatagramPackets using UDP_PROTOCOL. |
DatagramSocket |
getUdpSocket()
Returns the udp socket object |
void |
listen()
Listen for incoming connection requests |
void |
peekData(Variant var,
int type)
Look at incoming data without removing it from the buffer |
void |
removeSocketListener(SocketListener l)
|
void |
sendData(byte[] data)
|
void |
sendData(String data)
|
void |
sendData(Variant data)
Send data to remote computer |
void |
setLocalPort(int val)
Sets the port used on the local computer |
void |
setProtocol(int val)
Sets the socket protocol |
void |
setRemoteHostName(String hostName)
Sets the name used to identify the remote computer |
void |
setRemotePort(int val)
Sets the port to be connected to on the remote computer |
void |
setUdpBufferLength(int val)
Sets the buffer length used to receive DatagramPackets using UDP_PROTOCOL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TCP_PROTOCOL
public static final int UDP_PROTOCOL
public static final int CLOSED
public static final int OPEN
public static final int LISTENING
public static final int CONNECTION_PENDING
public static final int RESOLVING_HOST
public static final int HOST_RESOLVED
public static final int CONNECTING
public static final int CONNECTED
public static final int CLOSING
public static final int ERROR
public static final int ERROR_EVENT
public static final int DATA_ARRIVAL_EVENT
public static final int CONNECT_EVENT
public static final int CONNECTION_REQUEST_EVENT
public static final int CLOSE_EVENT
public static final int SEND_PROGRESS_EVENT
public static final int SEND_COMPLETE_EVENT
Constructor Detail |
---|
public DsSocket()
Method Detail |
---|
public void setUdpBufferLength(int val)
public int getUdpBufferLength()
public int getProtocol()
public void setProtocol(int val)
val
- One of: TCP_PROTOCOL, UDP_PROTOCOLpublic String getLocalHostName()
public String getLocalIP()
public int getLocalPort()
public void setLocalPort(int val)
public Socket getSocket()
public DatagramSocket getUdpSocket()
public String getRemoteHostIP()
public int getRemotePort()
public void setRemotePort(int val)
public String getRemoteHostName()
public void setRemoteHostName(String hostName) throws UnknownHostException
UnknownHostException
public InetAddress getRemoteHostAddress()
public int getState()
public int getBytesReceived()
public void connect(String remoteHostName, int remotePort) throws IOException, UnknownHostException
IOException
UnknownHostException
public void connect() throws IOException, UnknownHostException
IOException
UnknownHostException
public void listen()
public void accept()
public void sendData(Variant data) throws IOException, SocketException
IOException
SocketException
public void sendData(String data) throws IOException, SocketException
IOException
SocketException
public void sendData(byte[] data) throws IOException, SocketException
IOException
SocketException
protected static byte[] convertToBytes(Variant var)
protected static void convertToVariant(byte[] b, Variant var, int type)
public void getData(Variant var, int type)
public void peekData(Variant var, int type)
public void close() throws IOException
IOException
public void bind(int LocalPort)
public void addSocketListener(SocketListener l)
public void removeSocketListener(SocketListener l)
|
Diamond Control Suite 3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |