|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--MiCasa.ServidorCasa
La clase ServidorCasa implementa la funcionalidad del servidor.
Es capaz de recibir y procesar los comandos que le envía el
cliente a través del socket, y los transforma en peticiones sobre
la base de datos gracias a la clase BaseDatos
.
Field Summary | |
private java.io.BufferedReader |
br
Filtro para poder leer del socket línea a línea. |
private int |
compraVivienda
Variable con la vivienda que se desea comprar |
private java.io.DataOutputStream |
dos
Filtro para poder escribir al socket líneas enteras. |
private int |
estado
Variable con el estado del servidor. |
private java.net.Socket |
so
Socket a través del cual llevar a cabo la comunicación. |
private java.lang.String |
usuario
Nombre del usuario que ha entrado. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ServidorCasa(java.net.Socket s)
Constructor del servidor. |
Method Summary | |
private void |
Desconectar()
Cierra una conexión, tanto el socket como los filtros. |
void |
run()
Lleva a cabo el proceso de recepción y tratamiento de comandos remotos. |
private void |
TratarCOMPRAR_VIVIENDA(java.util.StringTokenizer sTok)
Trata el mensaje COMPRAR_VIVIENDA. |
private void |
TratarCONFIRMAR_COMPRA()
Compra confirmada. |
private void |
TratarLISTADO_VIVIENDAS(java.util.StringTokenizer sTok)
Trata el mensaje LISTADO_VIVIENDAS. |
private void |
TratarPASSWORD(java.util.StringTokenizer sTok)
Trata el mensaje PASSWORD del usuario. |
private void |
TratarRECHAZAR_COMPRA()
El usuario aborta la compra. |
private void |
TratarSALIR()
Manda un mensaje de despedida antes de cerrar el grifo. |
private void |
TratarUSER(java.util.StringTokenizer sTok)
Trata el mensaje USER del usuario. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.lang.String usuario
private java.net.Socket so
private java.io.BufferedReader br
private java.io.DataOutputStream dos
private int estado
private int compraVivienda
Constructor Detail |
public ServidorCasa(java.net.Socket s)
s
- Socket a través del cual se lleva la comunicación.Method Detail |
private void Desconectar() throws java.io.IOException
java.io.IOException
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
private void TratarUSER(java.util.StringTokenizer sTok) throws java.io.IOException
java.io.IOException
private void TratarPASSWORD(java.util.StringTokenizer sTok) throws java.io.IOException
java.io.IOException
private void TratarLISTADO_VIVIENDAS(java.util.StringTokenizer sTok) throws java.io.IOException
java.io.IOException
private void TratarCOMPRAR_VIVIENDA(java.util.StringTokenizer sTok) throws java.io.IOException
java.io.IOException
private void TratarRECHAZAR_COMPRA() throws java.io.IOException
java.io.IOException
private void TratarCONFIRMAR_COMPRA() throws java.io.IOException
java.io.IOException
private void TratarSALIR()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |