/**
* sendBytes() sends an array of bytes
*/
- public void sendBytes(byte vals[]) throws IOException
+ public synchronized void sendBytes(byte vals[]) throws IOException
{
int len = vals.length;
// Write the length first - convert to array of 4 bytes
/**
* receiveBytes() receives an array of bytes
*/
- public byte[] receiveBytes(byte val[]) throws IOException
+ public synchronized byte[] receiveBytes(byte val[]) throws IOException
{
int i;
int totalbytes = 0;
int numbytes;
+
// Wait until input is available
while(input.available() == 0);
// Read the maxlen first - read 4 bytes here
/**
* Close socket connection
*/
- public void close() throws IOException
+ public synchronized void close() throws IOException
{
sock.close();
}
/**
* Send ACK
*/
- public void sendAck() throws IOException
+ public synchronized void sendAck() throws IOException
{
int ack;
ack = 0;
/**
* Receive ACK
*/
- public void receiveAck() throws IOException
+ public synchronized void receiveAck() throws IOException
{
int ack;
ack = (int) input.read();