#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Moming
# 2016-04-07
# ping for Windows
import os
import sys
import socket
import struct
import select
import time
import ctypes
ICMP_ECHO_REQUEST = 8
def receive_ping(my_socket, ID, timeout):
""" receive the ping from the socket """
start_time = timeout
while True:
start_select = time.clock()
# select.select(rlist, wlist, xlist[, timeout])
# wait until ready for read / write / exceptional condition
# The return value is a triple of lists
what_ready = select.select([my_socket], [], [], start_time)
how_long = (time.clock() - start_select)
if what_ready[0] == []: #timeout
return
time_received = time.clock()
#