Package builder.netsiddev
Klasse NetSIDDevConnection
java.lang.Object
builder.netsiddev.NetSIDDevConnection
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprivate Socketprivate static NetSIDDevConnectionSingle instance connection.private booleanprivate static final CharsetExpected string encoding read from server.private static final intMaximum string length read from server.private static final intTimeout to establish a connection to a NetworkSIDDevice im ms.private byte[] -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclose()Close the connection.private voidOpen connection to serverstatic final NetSIDDevConnectionvoidInvalidate the connection.private booleanisClosed()Connection has been closed?booleanbooleanConnection has been invalidated?voidConnect to server, if not already connected or connection changedintreceive()Receive byte from server.Receive zero terminated byte array as string (ISO-88-59-1).voidsend(byte[] cmd) Send byte array to server.
-
Felddetails
-
SOCKET_CONNECT_TIMEOUT
private static final int SOCKET_CONNECT_TIMEOUTTimeout to establish a connection to a NetworkSIDDevice im ms.- Siehe auch:
-
MAX_STRING_LENGTH
private static final int MAX_STRING_LENGTHMaximum string length read from server.- Siehe auch:
-
ISO_8859_1
Expected string encoding read from server. -
invalidated
private boolean invalidated -
connectedSocket
-
stringBytes
private byte[] stringBytes -
connection
Single instance connection.
-
-
Konstruktordetails
-
NetSIDDevConnection
private NetSIDDevConnection()
-
-
Methodendetails
-
getInstance
-
open
Connect to server, if not already connected or connection changed- Parameter:
hostname- server host nameport- server port address- Löst aus:
IOException- socket I/O error
-
connect
Open connection to server- Parameter:
hostname- server host nameport- server port address- Löst aus:
IOException- socket I/O error
-
close
public void close()Close the connection. -
isClosed
private boolean isClosed()Connection has been closed?- Gibt zurück:
- connection closed
-
invalidate
public void invalidate()Invalidate the connection. -
isInvalidated
public boolean isInvalidated()Connection has been invalidated?- Gibt zurück:
- connection invalid, must be re-opened
-
send
Send byte array to server.- Parameter:
cmd- byte array to send- Löst aus:
IOException- socket I/O error
-
receive
Receive byte from server.- Gibt zurück:
- received byte
- Löst aus:
IOException- socket I/O error
-
receiveString
Receive zero terminated byte array as string (ISO-88-59-1).- Gibt zurück:
- string received from server.
- Löst aus:
IOException- socket I/O error
-
isDisconnected
public boolean isDisconnected()
-