java - Why Californium wait after 65535 records while sending data using CoAP protocol -
i'm using californium api ( https://github.com/eclipse/californium ) send data using coap protocol.
below snippet both client , server.
server :
public class helloworldserver extends coapserver { /* * application entry point. */ public static void main(string[] args) { try { // create server helloworldserver server = new helloworldserver(); server.start(); } catch (socketexception e) { system.err .println("failed initialize server: " + e.getmessage()); } } /* * constructor new hello-world server. here, resources of * server initialized. */ public helloworldserver() throws socketexception { // provide instance of hello-world resource add(new helloworldresource()); } /* * definition of hello-world resource */ class helloworldresource extends coapresource { public helloworldresource() { // set resource identifier super("helloworld"); // set display name getattributes().settitle("hello-world resource"); } @override public void handleget(coapexchange exchange) { // respond request exchange.respond("hello world!"); } @override public void handlepost(coapexchange exchange){ //system.out.println("start "+system.currenttimemillis()); exchange.accept(); //list<string> queries = exchange.getrequestoptions().geturiqueries(); // system.out.println("text received : "+ exchange.getrequesttext().length()); // system.out.println("end "+system.currenttimemillis()); exchange.respond("received"); } } }
client code :
try { long starttime = system.currenttimemillis(); (int = 0; < 1000000; i++) { coapclient client = new coapclient(new uri("coap://192.168.15.170:5683/helloworld")); coapresponse response = client.post(str, 0); } system.out.println("done"); } catch (urisyntaxexception e) { e.printstacktrace(); }catch (exception e) { e.printstacktrace(); }
i'm sending 1000000 records while sending first send 65535 records , wait few seconds.after waiting few seconds again starts sending.
system details :
os : win 7 64 bit. ram : 4 gm
why wait after 65535 records?
i gone through californium.coap receives 250 records per second. have added relay of 4 ms.so manage send less 250 records/second.
if sending data different machine same coap server resource, need manage delay accordingly.
coap message id (mid) ranginf 1-65565 only.
also configure californium.properties work.
Comments
Post a Comment