* Default constructor
*/
public IoTSocketClient(int _port, String _address, int rev) throws IOException
- {
+ {
super(_port);
try {
sock = new Socket( InetAddress.getByName(_address), port );
output.write(rev);
output.flush();
}
+
+ /**
+ * Additional constructor
+ */
+ public IoTSocketClient(int _localPort, int _port, String _address, int rev) throws IOException
+ {
+ super(_localPort, _port);
+ try {
+ sock = new Socket( InetAddress.getByName(_address),
+ port, InetAddress.getByName(_address), localPort );
+ input = new BufferedInputStream(sock.getInputStream(), BUFFSIZE);
+ output = new BufferedOutputStream(sock.getOutputStream(),BUFFSIZE);
+ }
+ catch ( IOException e ) {
+ e.printStackTrace();
+ }
+ // now we want to tell the server if we want reversed bytes or not
+ output.write(rev);
+ output.flush();
+ }
}