All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.net.XorSocket
java.lang.Object
|
+----java.net.Socket
|
+----sdsu.net.XorSocket
- public class XorSocket
- extends Socket
This class implements client sockets (also called just
"sockets"). A socket is an endpoint for communication
between two machines. Each input and output byte is
Xor'ed with the byte mask provided in the constructor.
This provides a very weak form of encryption.
- Version:
- 1.0 14 Feb 1998
- Author:
- Roger Whitney
(whitney@cs.sdsu.edu)
- See Also:
- Socket
-
XorSocket(byte)
-
Creates an unconnected socket.
-
XorSocket(InetAddress, int, byte)
-
Creates a stream socket and connects it to the specified port
number at the specified IP address.
-
XorSocket(InetAddress, int, InetAddress, int, byte)
-
Creates a socket and connects it to the specified remote address on
the specified remote port.
-
XorSocket(String, int, byte)
-
Constructor for class XorSocket.
-
XorSocket(String, int, InetAddress, int, byte)
-
Creates a socket and connects it to the specified remote host on
the specified remote port.
-
close()
-
-
getInputStream()
-
Returns an inputstream on the socket.
-
getOutputStream()
-
Returns an outputstream on the socket.
XorSocket
public XorSocket(byte mask) throws IOException
- Creates an unconnected socket. Used in Socket factories.
- Parameters:
- mask - byte mask with which all input/output bytes
are Xor'ed
- Throws: IOException
- if an I/O error occurs when creating
the socket.
XorSocket
public XorSocket(String host,
int port,
byte mask) throws IOException
- Constructor for class XorSocket.
- Parameters:
- host - the remote machine to connect to
- port - the remote TCP port
- mask - byte mask with which all input/output bytes
are Xor'ed
- Throws: IOException
- if an I/O error occurs when creating
the socket.
XorSocket
public XorSocket(InetAddress address,
int port,
byte mask) throws IOException
- Creates a stream socket and connects it to the specified port
number at the specified IP address.
- Parameters:
- address - the IP address.
- port - the port number.
- mask - byte mask with which all input/output bytes
are Xor'ed
- Throws: IOException
- if an I/O error occurs when creating
the socket.
XorSocket
public XorSocket(String host,
int port,
InetAddress localAddr,
int localPort,
byte mask) throws IOException
- Creates a socket and connects it to the specified remote host on
the specified remote port. The Socket will also bind() to the local
address and port supplied.
- Parameters:
- host - the name of the remote host
- port - the remote port
- localAddr - the local address the socket is bound to
- localPort - the local port the socket is bound to
- mask - byte mask with which all input/output bytes
are Xor'ed
- Throws: IOException
- if an I/O error occurs when creating
the socket.
XorSocket
public XorSocket(InetAddress address,
int port,
InetAddress localAddr,
int localPort,
byte mask) throws IOException
- Creates a socket and connects it to the specified remote address on
the specified remote port. The Socket will also bind() to the local
address and port supplied.
- Parameters:
- address - the remote address
- port - the remote port
- localAddr - the local address the socket is bound to
- localPort - the local port the socket is bound to
- mask - byte mask with which all input/output bytes
are Xor'ed
- Throws: IOException
- if an I/O error occurs when creating
the socket.
getInputStream
public InputStream getInputStream() throws IOException
- Returns an inputstream on the socket.
All bytes in the stream are Xor'ed with the sockets
Xor mask;
- Throws: IOException
- if an I/O error occurs.
- Overrides:
- getInputStream in class Socket
getOutputStream
public OutputStream getOutputStream() throws IOException
- Returns an outputstream on the socket.
All bytes in the stream are Xor'ed with the sockets
Xor mask;
- Throws: IOException
- if an I/O error occurs.
- Overrides:
- getOutputStream in class Socket
close
public synchronized void close() throws IOException
- Overrides:
- close in class Socket
All Packages Class Hierarchy This Package Previous Next Index