superwaba.ext.xplat.io
Class SerialSocket
java.lang.Object
|
+--waba.io.Stream
|
+--waba.io.Socket
|
+--superwaba.ext.xplat.io.SerialSocket
- public class SerialSocket
- extends Socket
class SerialSocket
This is the client-side class. It implements a socket-through-a-serial-port.
Created by Rick Grehan and ported to SuperWaba by Guich.
Constructor Summary |
SerialSocket(String host,
int port,
int baud)
Create and open the Socket |
Method Summary |
boolean |
close()
Close the Socket |
boolean |
isOpen()
Return true if socket is open - false otherwise |
int |
readBytes(byte[] buf,
int start,
int count)
Read bytes from the Socket into a byte array |
boolean |
setReadTimeout(int millis)
Sets the read timeout. |
void |
shutdownServer()
Shutdown the server. |
int |
writeBytes(byte[] buf,
int start,
int count)
Write bytes from the Socket into a byte array |
CREATE
public static final byte CREATE
READ
public static final byte READ
WRITE
public static final byte WRITE
CLOSE
public static final byte CLOSE
SerialSocket
public SerialSocket(String host,
int port,
int baud)
- Create and open the Socket
isOpen
public boolean isOpen()
- Return true if socket is open - false otherwise
- Overrides:
- isOpen in class Socket
readBytes
public int readBytes(byte[] buf,
int start,
int count)
- Read bytes from the Socket into a byte array
- Overrides:
- readBytes in class Socket
- Tags copied from class: Socket
- Parameters:
buf
- the byte array to read data intostart
- the start position in the byte arraycount
- the number of bytes to read
writeBytes
public int writeBytes(byte[] buf,
int start,
int count)
- Write bytes from the Socket into a byte array
- Overrides:
- writeBytes in class Socket
- Tags copied from class: Socket
- Parameters:
buf
- the byte array to write data fromstart
- the start position in the byte arraycount
- the number of bytes to write
close
public boolean close()
- Close the Socket
- Overrides:
- close in class Socket
shutdownServer
public void shutdownServer()
- Shutdown the server.
setReadTimeout
public boolean setReadTimeout(int millis)
- Sets the read timeout. Note that this is the timeout for a Serial connection.
The default is 10 seconds.
- Overrides:
- setReadTimeout in class Socket
- Tags copied from class: Socket
- Parameters:
millis
- timeout in milliseconds.