18 lines
471 B
Python
18 lines
471 B
Python
|
from .packet import Packet
|
||
|
from .EnumQuery import EnumQuery
|
||
|
import socket
|
||
|
import threading
|
||
|
|
||
|
|
||
|
class Netclient:
|
||
|
def __init__(self, ip, port):
|
||
|
self.ip = ip
|
||
|
self.port = port
|
||
|
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
|
||
|
|
||
|
def send(self, packet):
|
||
|
self.socket.sendto(packet.getvalue(), (self.ip, self.port))
|
||
|
print("R>", packet.getvalue().hex())
|
||
|
|
||
|
def receive(self):
|
||
|
return self.socket.recv(4096)
|