Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
def recv_with_timeout(the_socket,timeout=2): the_socket.setblocking(0) total_data= new_total_data= data='' begin=time.time() while True: #if you got some data, then break after wait sec if total_data and time.time()-begin>timeout: print "Hit timeout" #333 break #if you got no data at all, wait a little longer elif time.time()-begin>timeout*2: break try: data=the_socket.recv(8192) if data: print "data = ", data #333 if EOT in data: print "EOT found" #333 total_data.append(data[:data.find(End)]) break total_data.append(data) if len(total_data)>1: #check if EOT_of_data was split if EOT in ''.join(total_data): #last_pair: print "EOT was split" #333 break begin=time.time() else: time.sleep(0.1) except: pass final_data = ''.join(total_data) final_data = final_data.rstrip('(0x04)') return final_data
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.