summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-01 11:09:27 +0200
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-01 11:09:27 +0200
commitd50a913b21b1ceec3bf22915caa87a8a9b44e3d1 (patch)
tree3dafc89e254e88b269253247e79a22d8c3fdf5cf /main.c
parentc9711c2fa0ae0efbf0e847d4226d0ab04edc05f2 (diff)
downloadMAC-Telnet-d50a913b21b1ceec3bf22915caa87a8a9b44e3d1.tar.gz
MAC-Telnet-d50a913b21b1ceec3bf22915caa87a8a9b44e3d1.zip
Added keepalive functionality
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.c b/main.c
index a5e919e..f15d811 100644
--- a/main.c
+++ b/main.c
@@ -196,6 +196,7 @@ int main (int argc, char **argv) {
char buff[1500];
int plen = 0;
struct timeval timeout;
+ int keepalive_counter = 0;
fd_set read_fds;
if (argc < 4) {
@@ -343,6 +344,14 @@ int main (int argc, char **argv) {
memcpy(data + plen, &key, 1);
result = sendUDP(data, plen + 1);
}
+ } else {
+ /* keepalive */
+ if ((keepalive_counter++ % 10) == 0) {
+ char odata[22];
+ int plen=0,result=0;
+ plen = initPacket(odata, MT_PTYPE_ACK, srcmac, dstmac, sessionkey, 0);
+ result = sendUDP(odata, plen);
+ }
}
}
resetTerm();