|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.x11.Connection
public class Connection
Low-level network input/output with X server.
Whenever the server is writing to a given connection, it is permissible for the server to stop reading from that connection (but if the writing would block, it must continue to service other connections). The server is not required to buffer more than a single request per connection at one time. For a given connection to the server, a client can block while reading from the connection but should undertake to read (events and errors) when writing would block. Failure on the part of a client to obey this rule could result in a deadlocked connection, although deadlock is probably unlikely unless either the transport layer has very little buffering or the client attempts to send large numbers of requests without ever reading replies or checking for errors and events.
Whether or not a server is implemented with internal concurrency, the overall effect must be as if individual requests are executed to completion in some serial order, and requests from a given connection must be executed in delivery order (that is, the total execution order is a shuffle of the individual streams). The execution of a request includes validating all arguments, collecting all data for any reply, and generating and queueing all required events. However, it does not include the actual transmission of the reply and the events. In addition, the effect of any other cause that can generate multiple events (for example, activation of a grab or pointer motion) must effectively generate and queue all required events indivisibly with respect to all other causes and requests. For a request from a given client, any events destined for that client that are caused by executing the request must be sent to the client before any reply or error is sent.
Field Summary | |
---|---|
static int |
ASYNCHRONOUS
In this mode, protocol requests are sent asynchronously to X server. |
java.io.DataInputStream |
din
|
Display |
display
|
int |
display_no
|
java.util.Vector |
events
|
java.lang.String |
hostname
|
static int |
MAX_REUQEST_COUNT
|
int |
next_seq_no
Request sequence number counter. |
java.io.OutputStream |
out
|
java.lang.Object |
read_lock
|
boolean |
reading_reply
|
int |
request_count
|
Request[] |
requests
|
static int |
ROUND_TRIP
In this mode, protocol requests are sent synchronously to X server, and X server is deliberately forced to give a round-trip reply. |
Data |
saved_reply
|
int |
send_mode
valid: ASYNCHRONOUS (default),
SYNCHRONOUS ,
ROUND_TRIP |
static java.lang.String[] |
SEND_MODE_STRINGS
|
java.net.Socket |
socket
|
static int |
SYNCHRONOUS
In this mode, protocol requests are sent synchronously to X server. |
Constructor Summary | |
---|---|
Connection(Display display,
java.lang.String hostname,
int display_no)
|
Method Summary | |
---|---|
void |
check_error()
|
void |
close()
Flush all queued requests and close network connection. |
boolean |
enqueue_request(Request request)
|
void |
flush()
|
java.util.Vector |
pull_all_events()
Pull all events on network. |
Event |
read_event(boolean blocking,
boolean remove)
|
Data |
read_message(boolean blocking)
|
Data |
read_reply(Request request)
|
int |
send(Request request,
boolean round_trip)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Display display
public int display_no
public java.lang.String hostname
public java.net.Socket socket
public java.io.DataInputStream din
public java.lang.Object read_lock
public boolean reading_reply
public Data saved_reply
public java.util.Vector events
public int send_mode
ASYNCHRONOUS
(default),
SYNCHRONOUS
,
ROUND_TRIP
public static final java.lang.String[] SEND_MODE_STRINGS
public static final int ASYNCHRONOUS
public static final int SYNCHRONOUS
public static final int ROUND_TRIP
public static final int MAX_REUQEST_COUNT
public int request_count
public Request[] requests
public java.io.OutputStream out
public int next_seq_no
From Protocol Specification: Every request on a given connection is implicitly assigned a sequence number, starting with one, that is used in replies, errors, and events.
Constructor Detail |
---|
public Connection(Display display, java.lang.String hostname, int display_no)
Method Detail |
---|
public void check_error()
public void close()
flush()
public boolean enqueue_request(Request request)
public void flush()
public java.util.Vector pull_all_events()
Puppet.read_and_dispatch_event()
as well) to
pull all events on server.
display.grab_server (); display.check_error (); Vector all_and_everything = pull_all_events (); display.grab_server ();Note
display.check_error ()
forces a round-trip reply
from X server, and X server would flush pending all events before
that reply.
public Event read_event(boolean blocking, boolean remove)
public Data read_message(boolean blocking)
public Data read_reply(Request request)
public int send(Request request, boolean round_trip)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |