|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpeerbase.socket.NormalSocket
public class NormalSocket
Encapsulates the standard Socket object of the Java library to fit the SocketInterface of the PeerBase system.
| Constructor Summary | |
|---|---|
NormalSocket(java.net.Socket socket)
Encapsulates a normal Java API Socket object. |
|
NormalSocket(java.lang.String host,
int port)
Creates a stream socket and connects it to the specified port number on the named host. |
|
| Method Summary | |
|---|---|
void |
close()
Closes this connection and releases any system resources associated with the socket. |
int |
read()
Reads the next byte of data from the socket connection. |
int |
read(byte[] b)
Reads some number of bytes from the socket connection and stores them into the buffer array b. |
void |
write(byte[] b)
Writes b.length bytes from the specified byte array to this socket connection. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NormalSocket(java.lang.String host,
int port)
throws java.io.IOException,
java.net.UnknownHostException
host - the host name, or null for the loopback addressport - the port number
java.io.IOException - if an I/O error occurs when creating the socket
java.net.UnknownHostException - if the IP address of the host could not be determined
public NormalSocket(java.net.Socket socket)
throws java.io.IOException
socket - an already-open socket connection
java.io.IOException| Method Detail |
|---|
public void close()
throws java.io.IOException
SocketInterface
close in interface SocketInterfacejava.io.IOException - if an I/O error occurs
public int read()
throws java.io.IOException
SocketInterface
read in interface SocketInterfacejava.io.IOException - if an I/O error occurs
public int read(byte[] b)
throws java.io.IOException
SocketInterface
read in interface SocketInterfaceb - the buffer into which the data is read
java.io.IOException - if an I/O error occursInputStream#read()
public void write(byte[] b)
throws java.io.IOException
SocketInterface
write in interface SocketInterfaceb - the data
java.io.IOException - if an I/O error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||