def isOpen(self, dom, port): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) addr = (dom, int(port)) try: s.bind(addr) s.close() return True except: return False
def bind(self): """ After initializing you must UDPServer.listen() to bind to the socket and accept whatever packets are in the buffer. Since we're binding a non-blocking socket, your program (and Ableton Live) will still be able to run. """ self.addr = (self.src, self.srcPort) self.UDPSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.UDPSock.bind(self.addr) self.UDPSock.setblocking(0)
def bind(self): """ After initializing you must UDPServer.listen() to bind to the socket and accept whatever packets are in the buffer. Since we're binding a non-blocking socket, your program (and Ableton Live) will still be able to run. """ self.addr = (self.src,self.srcPort) self.UDPSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) self.UDPSock.bind(self.addr) self.UDPSock.setblocking(0)
def open(self): """ Open our UDPSock for listening, sets self.UDPSock """ if not self.dst: return if not self.dstPort: return # Open up our socket, we're ready for business! self.addr = (self.dst, self.dstPort) self.UDPSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def open(self): """ Open our UDPSock for listening, sets self.UDPSock """ if not self.dst: return if not self.dstPort: return # Open up our socket, we're ready for business! self.addr = (self.dst,self.dstPort) self.UDPSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)