10 /** Class IoTSocketClient is a communication class
11 * that extends IoTSocket. This is the client side.
13 * Adapted from Java/C++ socket implementation
15 * @see <a href="https://www.keithv.com/software/socket/</a>
17 * @author Rahmadi Trimananda <rtrimana @ uci.edu>
21 public class IoTSocketClient extends IoTSocket {
26 public IoTSocketClient(int _port, String _address, int rev) throws IOException
30 sock = new Socket( InetAddress.getByName(_address), port );
31 input = new BufferedInputStream(sock.getInputStream(), BUFFSIZE);
32 output = new BufferedOutputStream(sock.getOutputStream(),BUFFSIZE);
34 catch ( IOException e ) {
37 // now we want to tell the server if we want reversed bytes or not
43 * Additional constructor
45 public IoTSocketClient(int _localPort, int _port, String _address, int rev) throws IOException
47 super(_localPort, _port);
49 sock = new Socket( InetAddress.getByName(_address),
50 port, InetAddress.getByName(_address), localPort );
51 input = new BufferedInputStream(sock.getInputStream(), BUFFSIZE);
52 output = new BufferedOutputStream(sock.getOutputStream(),BUFFSIZE);
54 catch ( IOException e ) {
57 // now we want to tell the server if we want reversed bytes or not