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()
ClientServicegetMode in interface ClientServicepublic void connect(java.lang.String host,
int port)
throws java.lang.Exception
ClientServiceconnect in interface ClientServicejava.lang.Exceptionpublic boolean isConnected()
ClientServiceisConnected in interface ClientServicepublic void close()
throws java.io.IOException
ClientServiceclose in interface ClientServicejava.io.IOExceptionpublic void sendBytes(byte[] data)
throws java.io.IOException
ClientServicesendBytes in interface ClientServicejava.io.IOExceptionpublic void sendBytes(java.lang.String data,
java.lang.String charset)
throws java.io.IOException
ClientServicesendBytes in interface ClientServicejava.io.IOExceptionpublic void sendLine(java.lang.String data,
java.lang.String charset)
throws java.io.IOException
ClientServicesendLine in interface ClientServicejava.io.IOExceptionpublic void sendObject(java.lang.Object data)
throws java.io.IOException
ClientServicesendObject in interface ClientServicejava.io.IOExceptionpublic byte[] readBytes()
throws java.io.IOException
ClientServicereadBytes in interface ClientServicejava.io.IOExceptionpublic java.lang.String readBytes(java.lang.String charset)
throws java.io.IOException
ClientServicereadBytes in interface ClientServicejava.io.IOExceptionpublic java.lang.String readLine()
throws java.io.IOException
ClientServicereadLine in interface ClientServicejava.io.IOExceptionpublic java.lang.Object readObject()
throws java.io.IOException,
java.lang.ClassNotFoundException
ClientServicereadObject in interface ClientServicejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic java.net.Socket getSocket()
ClientServicegetSocket in interface ClientServicepublic byte[] sendAndReceiveBinary(java.lang.String host,
int port,
byte[] data)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String sendAndReceiveBytes(java.lang.String host,
int port,
java.lang.String data)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String sendAndReceiveLine(java.lang.String host,
int port,
java.lang.String data)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Object sendAndReceiveObject(java.lang.String host,
int port,
java.lang.Object data)
throws java.lang.Exception
java.lang.Exceptionpublic int readByte()
throws java.io.IOException
ClientServicereadByte in interface ClientServicejava.io.IOExceptionpublic void sendByte(int data)
throws java.io.IOException
ClientServicesendByte in interface ClientServicejava.io.IOExceptionCopyright © 2003-2014 QuickServer.org