mobnet
Class MobNet

java.lang.Object
  extended bymobnet.MobNet

public class MobNet
extends java.lang.Object

MobNet.java - Class contains individual network information for each node and initilaises node with the Manager

Author:
Avi TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Constructor Summary
MobNet(java.lang.String IP)
          Constructor for MobNet.
 
Method Summary
 java.lang.String getIP()
          Get the Socket which belongs to the specified port.
 Socket getSocket(int port)
          Get the Socket which belongs to the specified port.
 int inBufferSize()
           
 boolean inready()
           
 java.lang.Object receive()
           
 void send(java.lang.Object s, java.lang.String IPDest)
           
 void send(Packet p)
          Insert packet into the Virtual Network.
 void setServerSocket(ServerSocket s)
          Insert the ServerSocket into the ArrayList register of ServerSockets.
 void setSocket(Socket sock, int port, java.lang.String destIP)
          Insert the Socket into the ArrayList register of Sockets.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MobNet

public MobNet(java.lang.String IP)
Constructor for MobNet.

Parameters:
IP - Set the IP address for the node.
Method Detail

send

public void send(java.lang.Object s,
                 java.lang.String IPDest)

send

public void send(Packet p)
Insert packet into the Virtual Network.

Parameters:
p - The Packet to be inserted.

setSocket

public void setSocket(Socket sock,
                      int port,
                      java.lang.String destIP)
               throws java.net.BindException
Insert the Socket into the ArrayList register of Sockets.

Parameters:
sock - The Socket to be inserted.
port - The port to which the socket has been assigned
destIP - the IP of the destination of the Socket
Throws:
java.net.BindException

setServerSocket

public void setServerSocket(ServerSocket s)
Insert the ServerSocket into the ArrayList register of ServerSockets.

Parameters:
s - The ServerSocket to be inserted.

getSocket

public Socket getSocket(int port)
Get the Socket which belongs to the specified port.

Parameters:
port - The port whose socket we wish to return.

inready

public boolean inready()

receive

public java.lang.Object receive()

getIP

public java.lang.String getIP()
Get the Socket which belongs to the specified port.

Returns:
String The IP Address to which this MobNet is bound.

inBufferSize

public int inBufferSize()