org.vigia.server.communications
Class DataCommunicator

java.lang.Object
  extended by org.vigia.server.communications.DataCommunicator

public class DataCommunicator
extends java.lang.Object

Implements the client data communication.

Author:
jrios

Field Summary
protected  java.io.ByteArrayOutputStream baos
          A buffer for the image.
private  java.net.InetAddress clientAddr
          The client's Internet address.
private  int clientPort
          The Client's port.
protected  long sequence
          The next sequence number.
protected  java.net.DatagramSocket socket
          The socket to communicate with the client.
 
Constructor Summary
DataCommunicator()
          Creates a data communicator.
 
Method Summary
 void sendFrame(java.awt.image.BufferedImage image)
          Sends a frame to the client.
 void setClientIp(java.net.InetAddress clientAddr)
          Sets the client's Internet address.
protected  void setClientPort(int clientPort)
          Sets the client's port.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected java.net.DatagramSocket socket
The socket to communicate with the client.


clientPort

private int clientPort
The Client's port.


clientAddr

private java.net.InetAddress clientAddr
The client's Internet address.


sequence

protected long sequence
The next sequence number.


baos

protected java.io.ByteArrayOutputStream baos
A buffer for the image.

Constructor Detail

DataCommunicator

public DataCommunicator()
                 throws java.net.SocketException
Creates a data communicator.

Throws:
java.net.SocketException - Error creating the socket.
Method Detail

sendFrame

public void sendFrame(java.awt.image.BufferedImage image)
               throws java.io.IOException
Sends a frame to the client.

Parameters:
image - the frame.
Throws:
java.io.IOException - Error sending the frame.

setClientPort

protected void setClientPort(int clientPort)
Sets the client's port.

Parameters:
clientPort - The Client's port.

setClientIp

public void setClientIp(java.net.InetAddress clientAddr)
Sets the client's Internet address.

Parameters:
clientAddr - The client's Internet address.