public class BlockingUDPClient extends java.lang.Object implements ClientService
BLOCKING, NON_BLOCKING
Constructor and Description |
---|
BlockingUDPClient() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this socket.
|
void |
connect(java.lang.String host,
int port)
Connects this socket to the server.
|
int |
getMode()
Returns the client mode.
|
java.net.Socket |
getSocket()
Returns the Socket class that is used to communicate .
|
static int |
getTimeoutInSeconds() |
boolean |
isConnected()
Returns the connection state of the socket.
|
static boolean |
isDebug() |
int |
readByte()
Read next byte
|
byte[] |
readBytes()
Read binary data
|
java.lang.String |
readBytes(java.lang.String charset)
Read bytes (String)
|
java.lang.String |
readLine()
Read String appended with \r\n
|
java.lang.Object |
readObject()
Read String appended
|
byte[] |
sendAndReceiveBinary(java.lang.String host,
int port,
byte[] data) |
java.lang.String |
sendAndReceiveBytes(java.lang.String host,
int port,
java.lang.String data) |
java.lang.String |
sendAndReceiveLine(java.lang.String host,
int port,
java.lang.String data) |
java.lang.Object |
sendAndReceiveObject(java.lang.String host,
int port,
java.lang.Object data) |
void |
sendByte(int data)
Send binary data
|
void |
sendBytes(byte[] data)
Send binary data
|
void |
sendBytes(java.lang.String data,
java.lang.String charset)
Send bytes (String)
|
void |
sendLine(java.lang.String data,
java.lang.String charset)
Send String appended with \r\n
|
void |
sendObject(java.lang.Object data)
Send object
|
static void |
setDebug(boolean aDebug) |
static void |
setTimeoutInSeconds(int aTimeoutInSeconds) |
public static int getTimeoutInSeconds()
public static void setTimeoutInSeconds(int aTimeoutInSeconds)
public static boolean isDebug()
public static void setDebug(boolean aDebug)
public int getMode()
ClientService
getMode
in interface ClientService
public void connect(java.lang.String host, int port) throws java.lang.Exception
ClientService
connect
in interface ClientService
java.lang.Exception
public boolean isConnected()
ClientService
isConnected
in interface ClientService
public void close() throws java.io.IOException
ClientService
close
in interface ClientService
java.io.IOException
public void sendBytes(byte[] data) throws java.io.IOException
ClientService
sendBytes
in interface ClientService
java.io.IOException
public void sendBytes(java.lang.String data, java.lang.String charset) throws java.io.IOException
ClientService
sendBytes
in interface ClientService
java.io.IOException
public void sendLine(java.lang.String data, java.lang.String charset) throws java.io.IOException
ClientService
sendLine
in interface ClientService
java.io.IOException
public void sendObject(java.lang.Object data) throws java.io.IOException
ClientService
sendObject
in interface ClientService
java.io.IOException
public byte[] readBytes() throws java.io.IOException
ClientService
readBytes
in interface ClientService
java.io.IOException
public java.lang.String readBytes(java.lang.String charset) throws java.io.IOException
ClientService
readBytes
in interface ClientService
java.io.IOException
public java.lang.String readLine() throws java.io.IOException
ClientService
readLine
in interface ClientService
java.io.IOException
public java.lang.Object readObject() throws java.io.IOException, java.lang.ClassNotFoundException
ClientService
readObject
in interface ClientService
java.io.IOException
java.lang.ClassNotFoundException
public java.net.Socket getSocket()
ClientService
getSocket
in interface ClientService
public byte[] sendAndReceiveBinary(java.lang.String host, int port, byte[] data) throws java.lang.Exception
java.lang.Exception
public java.lang.String sendAndReceiveBytes(java.lang.String host, int port, java.lang.String data) throws java.lang.Exception
java.lang.Exception
public java.lang.String sendAndReceiveLine(java.lang.String host, int port, java.lang.String data) throws java.lang.Exception
java.lang.Exception
public java.lang.Object sendAndReceiveObject(java.lang.String host, int port, java.lang.Object data) throws java.lang.Exception
java.lang.Exception
public int readByte() throws java.io.IOException
ClientService
readByte
in interface ClientService
java.io.IOException
public void sendByte(int data) throws java.io.IOException
ClientService
sendByte
in interface ClientService
java.io.IOException
Copyright © 2003-2014 QuickServer.org