|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.util.Errorable
ewe.io.BasicStreamObject
ewe.io.StreamObject
ewe.net.SocketBase
ewe.net.Socket
A Socket is used to make a TCP/IP streaming connection to a remote host.
For devices which have an infra red port and support IrSock (e.g. WinCE devices) specifying a host name of "infra-red" will tell the socket to connect to any available device on the infra-red port.
| Nested Class Summary |
| Nested classes inherited from class ewe.net.SocketBase |
SocketBase.SocketInputStream, SocketBase.SocketOutputStream |
| Field Summary |
| Fields inherited from class ewe.net.SocketBase |
inputIsShutdown, inputStream, outputIsShutdown, outputStream, remoteHost, remotePort |
| Fields inherited from class ewe.io.StreamObject |
napIterations, napTime, READWRITE_CLOSED, READWRITE_ERROR, READWRITE_WOULDBLOCK |
| Fields inherited from class ewe.io.BasicStreamObject |
closed |
| Fields inherited from class ewe.util.Errorable |
error |
| Fields inherited from interface ewe.io.StreamCanPause |
PAUSE_UNTIL_CAN_READ, PAUSE_UNTIL_CAN_WRITE, PAUSE_UNTIL_CLOSED, PAUSE_UNTIL_FLUSHED |
| Constructor Summary | |
Socket(InetAddress host,
int port)
Opens a socket. |
|
Socket(String host,
int port)
Opens a socket. |
|
Socket(String host,
int port,
IOHandle handle)
Opens a socket. |
|
| Method Summary | |
boolean |
close()
Closes the socket. |
boolean |
flushStream()
This is non-blocking. |
InetAddress |
getInetAddress()
Get the remote host the socket is connected to. |
InputStream |
getInputStream()
Get an InputStream for reading from the connected Socket. |
InetAddress |
getLocalAddress()
Get the address of the local host the socket is bound to. |
int |
getLocalPort()
Get the local port the socket is bound to. |
OutputStream |
getOutputStream()
Get an OutputStream for writing to the connected Socket. |
int |
getPort()
Get the remote port the socket is connected to. |
protected int |
getSocketParameter(int par)
|
boolean |
isOpen()
Returns true if the socket is open and false otherwise. |
int |
nonBlockingRead(byte[] buf,
int start,
int count)
This returns: >0 = Number of bytes read. |
int |
nonBlockingWrite(byte[] buf,
int start,
int count)
This returns: >0 = Number of bytes written. |
int |
pauseUntilReady(int pauseType,
int time)
|
protected int |
setSocketParameter(int par,
boolean booleanValue,
int intValue)
|
InputStream |
toInputStream()
|
OutputStream |
toOutputStream()
|
| Methods inherited from class ewe.net.SocketBase |
getKeepAlive, getReceiveBufferSize, getSendBufferSize, getSoLinger, getTcpNoDelay, setKeepAlive, setReceiveBufferSize, setSendBufferSize, setSoLinger, setTcpNoDelay, shutdownInput, shutdownOutput |
| Methods inherited from class ewe.io.StreamObject |
closeStream, doRead, doWrite, flush, nap, nap, read, readAByte, readBytes, readBytes, write, writeAByte, writeBytes, writeBytes |
| Methods inherited from class ewe.io.BasicStreamObject |
getException, getName, read, read, throwIOException, toStream, write, write |
| Methods inherited from class ewe.util.Errorable |
returnError, returnError, returnError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Constructor Detail |
public Socket(String host,
int port)
throws IOException,
UnknownHostException
If you want to connect to a device via the infra-red port, set the host to be "infra-red".
host - the host name or IP address to connect to.port - the port number to connect to.
public Socket(InetAddress host,
int port)
throws IOException
If you want to connect to a device via the infra-red port, set the host to be "infra-red".
host - the host address to connect to.port - the port number to connect to.
public Socket(String host,
int port,
IOHandle handle)
If you want to connect to a device via the infra-red port, set the host to be "infra-red".
host - the host name or IP address to connect toport - the port number to connect tohandle - a handle to use for checking for successful connection.| Method Detail |
public boolean close()
close in interface BasicStreamclose in class StreamObjectpublic boolean isOpen()
isOpen in interface BasicStreamisOpen in class StreamObjectpublic int getPort()
public InetAddress getInetAddress()
public InetAddress getLocalAddress()
public int getLocalPort()
public int nonBlockingRead(byte[] buf,
int start,
int count)
nonBlockingRead in interface BasicStreamnonBlockingRead in class StreamObjectbuf - Destination byte array to hold incoming data.start - Starting index in buff for incoming data.count - Maximum number of bytes to read - should never be zero.
public int nonBlockingWrite(byte[] buf,
int start,
int count)
nonBlockingWrite in interface BasicStreamnonBlockingWrite in class StreamObjectbuf - Source byte array holding data to be written.start - Starting index in buff for data to be written.count - Number of bytes to write - should never be zero.
public boolean flushStream()
throws IOException
BasicStream
flushStream in interface BasicStreamIOException
public int pauseUntilReady(int pauseType,
int time)
pauseUntilReady in interface StreamCanPausepublic InputStream getInputStream()
public OutputStream getOutputStream()
public OutputStream toOutputStream()
toOutputStream in interface StreamtoOutputStream in class BasicStreamObjectpublic InputStream toInputStream()
toInputStream in interface StreamtoInputStream in class BasicStreamObjectprotected int getSocketParameter(int par)
getSocketParameter in class SocketBase
protected int setSocketParameter(int par,
boolean booleanValue,
int intValue)
setSocketParameter in class SocketBase
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||