0

below is mycode though i have set keepalive, socket connection gets closed after sometime.

        sb_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM,socket.SOL_TCP)
        sb_sock.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
        sb_sock.connect((msg_host, host_port))
        reg_msg="REG 0000 "+finder_id+"\r"
        sb_sock.send(reg_msg)
1
Contributor
1
Reply
2
Views
4 Years
Discussion Span
Last Post by hisan
1

i was able to acive this with below lines of code

        sb_sock.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 30000, 30000))
Votes + Comments
Thank you for sharing!
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.