Wip_copt_keepalive


#1

hi all,
i want to use keepalive option to send ping on a period. but i think it should be used with a tcp client channel which keeps the server address and port to be pinged . so there will be always a live client channel that sends pings to the server like google.com? or is there any way to send pings with a specified time period?


#2

Hiya,

Start the ping operation from a timer that fires at the desired interval. If the ping returns appropriately, restart the timer. If the ping times out, you’ve been disconnected from the network and have to take care of re-connection before restarting the timer.

Works well for me.

Note that you can use a lot of data if your timer is very frequent.

ciao, Dave


#3

i start using wip_pingCreateOpts function to create ping requests. But there is not much information about this operation on the documents. So i m asking how i can make a periodic ping requests with this function. i want to ping google.com every hour. then i tried following code

wip_pingCreateOpts(“www.google.com”,EventHandler_pingChannel,NULL,WIP_COPT_REPEAT,5, WIP_COPT_INTERVAL, 36000, WIP_COPT_END);

with this code, i wait that will send ping request five(5) times every hour(36000 ms). Then i follow EventHandler_pingChannel function. I get WIP_CEV_OPEN code for the first time. but then i can not get any message after 1 hour or later. shouldnt i get WIP_CEV_PING message after 1 hour? doesnt this code send pings to google with the interval of 36000 ms, 5 times?


#4

Isn’t there?

you haven’t said waht version you’re using, but for v4.00 it clearly says that WIP_COPT_REPEAT is the number of PING echo requests, and WIP_COPT_INTERVAL is the time between two PING echo requests in ms; so

Will send 5 PING echo requests, with an interval of 36000ms between each request.

This is exactly the same way that PING works from the Windows command line


#5

yes it says this but this is not enough for me. there isnt any line of codes even. And i see on my logs that it pings 5 echo request at the same time, not with the interval i supplied. it is like
WIP_CEV_OPEN 11:00:00 (this is time)
WIP_CEV_PING 11:00:01
WIP_CEV_PING 11:00:01
WIP_CEV_PING 11:00:01
WIP_CEV_PING 11:00:01
WIP_CEV_PING 11:00:01
WIP_CEV_PEER_CLOSE 11:00:01

And sometimes only;
WIP_CEV_OPEN

so i decided to use timer to send ping requests, i will check timeout by myself. i hope it would work.