public class AltingConnectionServerImpl<T> extends AltingConnectionServer<T>
Modifier and Type | Field and Description |
---|---|
protected static int |
SERVER_STATE_CLOSED
Server state.
|
protected static int |
SERVER_STATE_OPEN
Server state.
|
protected static int |
SERVER_STATE_RECEIVED
Server state.
|
FACTORY
Modifier | Constructor and Description |
---|---|
protected |
AltingConnectionServerImpl(AltingChannelInput<org.jcsp.lang.ConnectionMessage<T>> openIn,
AltingChannelInput<org.jcsp.lang.ConnectionMessage<T>> furtherRequestIn)
Constructs a new server instance.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getServerState() |
void |
reply(T data)
Sends some data back to the client after a request
has been received but keeps the connection open.
|
void |
reply(T data,
boolean close)
Sends some data back to the client after a request
has been received.
|
void |
replyAndClose(T data)
Sends some data back to the client and closes the connection.
|
T |
request()
Receives some data from a client once a connection
has been established.
|
getAltingChannel, pending, setAltingChannel
protected static final int SERVER_STATE_CLOSED
protected static final int SERVER_STATE_OPEN
protected static final int SERVER_STATE_RECEIVED
protected AltingConnectionServerImpl(AltingChannelInput<org.jcsp.lang.ConnectionMessage<T>> openIn, AltingChannelInput<org.jcsp.lang.ConnectionMessage<T>> furtherRequestIn)
public T request() throws java.lang.IllegalStateException
request(Object)
but by establishing
a connection.Object
sent by the client.java.lang.IllegalStateException
public void reply(T data) throws java.lang.IllegalStateException
recieve()
to receive a further request.data
- the data to send to the client.java.lang.IllegalStateException
public void reply(T data, boolean close) throws java.lang.IllegalStateException
true
.data
- the data to send to the client.close
- boolean
indicating whether or not the
connection should be closed.java.lang.IllegalStateException
public void replyAndClose(T data) throws java.lang.IllegalStateException
accept()
in order to allow another
connection to this server to be established.
If this method did not take any data to send back to the client,
and the server was meant to call reply(Object)
followed
by a close()
, then there would be a race hazard at the
client as it would not know whether the connection had
remained open or not.data
- the data to send back to client.java.lang.IllegalStateException
protected int getServerState()
Copyright © 1996–2023. All rights reserved.