hp.infrared
Class IrSocket
java.lang.Object
|
+--hp.infrared.IrSocket
- public class IrSocket
- extends java.lang.Object
This class implements client sockets over Infrared medium
- See Also:
IrServerSocket
Constructor Summary |
protected |
IrSocket()
Creates an unconnected socket. |
|
IrSocket(java.lang.String nickname,
int port)
Creates a socket and connects it to the specified port number on the
infrared device with the specified nickname. |
|
IrSocket(java.lang.String nickname,
java.lang.String servicename)
Creates a socket and connects it to the specified service on the
infrared device with the specified nickname. |
Method Summary |
void |
close()
Closes this socket. |
java.io.InputStream |
getInputStream()
Returns an input stream for this socket. |
java.io.OutputStream |
getOutputStream()
Returns an output stream for this socket. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
IrSocket
protected IrSocket()
- Creates an unconnected socket.
IrSocket
public IrSocket(java.lang.String nickname,
int port)
throws java.io.IOException
- Creates a socket and connects it to the specified port number on the
infrared device with the specified nickname. If the nickname is
specified as "ANY" then it connects to any device in sight.
- Parameters:
nickname
- nickname of the peer deviceport
- the port number- Throws:
- java.io.IOException - if I/O error occurs while creating the socket.
IrSocket
public IrSocket(java.lang.String nickname,
java.lang.String servicename)
throws java.io.IOException
- Creates a socket and connects it to the specified service on the
infrared device with the specified nickname.
- Parameters:
nickname
- nickname of the peer deviceservicename
- the name of the service- Throws:
- java.io.IOException - if I/O error occurs while creating the socket.
close
public void close()
throws java.io.IOException
- Closes this socket.
- Throws:
- java.io.IOException - if I/O error occurs while closing.
getInputStream
public java.io.InputStream getInputStream()
throws java.io.IOException
- Returns an input stream for this socket.
- Returns:
- an input stream for reading bytes from this socket.
- Throws:
- java.io.IOException - if I/O error occurs while creating the input stream.
getOutputStream
public java.io.OutputStream getOutputStream()
throws java.io.IOException
- Returns an output stream for this socket.
- Returns:
- an output stream for writing bytes to this socket.
- Throws:
- java.io.IOException - if I/O error occurs while creating the input stream.