|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.sandia.ccaffeine.dc.user_iface.MVC.ClientSocket
public class ClientSocket
Field Summary | |
---|---|
protected java.io.InputStream |
inputStream
|
protected java.io.LineNumberReader |
lineNumberReader
|
protected java.lang.Object |
lockRead
|
protected java.lang.Object |
lockWrite
|
protected java.io.OutputStream |
outputStream
|
protected java.io.PrintStream |
printStream
|
protected java.net.Socket |
socket
|
Constructor Summary | |
---|---|
ClientSocket()
Create a ClientSocket. |
Method Summary | |
---|---|
void |
close()
Close the communication link with the cca server. |
java.net.InetAddress |
getInetAddress()
Get the IP address of the socket |
java.io.InputStream |
getInputStream()
Return the input stream from the cca server. |
java.io.OutputStream |
getOutputStream()
Return the output stream to the cca server. |
void |
open(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Open a connection link to the cca server. |
void |
open(java.lang.String nameOfServerMachine,
int port)
Open a connection link to the cca server. |
void |
openAndSetTimeout(java.lang.String nameOfServerMachine,
int port,
int timeout)
Open a connection link to the cca server. |
void |
print(java.lang.String message)
Send a message to the cca server |
void |
println(java.lang.String message)
Send a message to the cca server |
int |
read(byte[] buffer)
Reads some number of bytes from the input stream and stores them into the buffer array b. |
java.lang.String |
readLine()
|
void |
write(byte[] buffer,
int offset,
int length)
Writes len bytes from the specified byte array starting at offset off to this output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.InputStream inputStream
protected java.io.LineNumberReader lineNumberReader
protected java.io.OutputStream outputStream
protected java.io.PrintStream printStream
protected java.net.Socket socket
protected java.lang.Object lockRead
protected java.lang.Object lockWrite
Constructor Detail |
---|
public ClientSocket()
Method Detail |
---|
public void open(java.lang.String nameOfServerMachine, int port) throws java.net.ConnectException
nameOfServerMachine
- The name of the machine
that contains the cca server.port
- The port number that the cca server is
using to provide services
java.net.ConnectException
- Thrown if we can not
establish a connection with the cca server.public void openAndSetTimeout(java.lang.String nameOfServerMachine, int port, int timeout) throws java.net.ConnectException
nameOfServerMachine
- The name of the machine
that contains the cca server.port
- The port number that the cca server is
using to provide services
java.net.ConnectException
- Thrown if we can not
establish a connection with the cca server.public void open(java.io.InputStream inputStream, java.io.OutputStream outputStream)
nameOfServerMachine
- The name of the machine
that contains the cca server.port
- The port number that the cca server is
using to provide services
java.net.ConnectException
- Thrown if we can not
establish a connection with the cca server.public void close()
public java.lang.String readLine() throws java.io.IOException
java.io.IOException
public void print(java.lang.String message)
message
- The string we are sending
to the cca server.public void println(java.lang.String message)
message
- The string we are sending
to the cca server.public void write(byte[] buffer, int offset, int length) throws java.io.IOException
buffer
- The dataoffset
- The start offset in the datalength
- The number of bytes to write
java.io.IOException
- if an I/O error occurs.
In particular, an IOException is thrown
if the output stream is closed.public int read(byte[] buffer) throws java.io.IOException
buffer
- the buffer into which the data is read.
java.io.IOException
- if an I/O error occurs.public java.net.InetAddress getInetAddress()
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |