edu.gwu.simplenetsim
Interface WebServer


public interface WebServer

This interface needs to be implemented by webservers.


Method Summary
 void init(int nodeNum, TransportLayer transport, int portNum)
          Initialization info.
 void receiveSTTPRequest(TransportPacket packet)
          The simulator calls this method with a packet that has the one and only STTP protocol packet - to request a file.
 void sendData()
          The simulator calls this regularly to ask the webserver to send any un-sent data to the transport layer below.
 

Method Detail

init

void init(int nodeNum,
          TransportLayer transport,
          int portNum)
Initialization info.

Parameters:
nodeNum - an int value
transport - a TransportLayer value
portNum - an int value

receiveSTTPRequest

void receiveSTTPRequest(TransportPacket packet)
The simulator calls this method with a packet that has the one and only STTP protocol packet - to request a file.

Parameters:
packet - a TransportPacket value

sendData

void sendData()
The simulator calls this regularly to ask the webserver to send any un-sent data to the transport layer below. One may ask: why doesn't the webserver send the whole file as one string? It's more realistic to send multiple strings, say, one string per line in the text file. Thus, the webserver should send one line at a time, which is why we need to keep calling the webserver to say "Got a line to send? Send it now.".