Wednesday, December 31, 2008

Server act

when server receive the datagram..

public void run() {
..
....
DatagramConnection dc = (DatagramConnection) Connector.open("datagram://:" + portString);
f.insert(1,new StringItem("Server ready on port "+portString,""));
sender = new Sender(dc);
while (true) {
Datagram dg = dc.newDatagram(100);
dc.receive(dg);
address = dg.getAddress();
f.insert(1,new StringItem(address+" : ",new String(dg.getData(), 0, dg.getLength())));
}
}
The dialog, ...:

Server : waiting in the front house (near street)
Server : I'm ready at here !
Server : (making sender)
Server : prepare for receiving my goods(making a box, 10 x 2 x 5)
Server : waiting until I receiving my goods
Server : I get the goods! I'll put in the box.
Server : (See the sender label) aaah, from my client!
Server : (Placing the goods)I opened the box, and place the data in the "f" table.

No comments:

Post a Comment