0
UDP client not returning any data
I am learning how to create a basic udp client with python. The problem is that the data variable is not returning any data. The screen remains blank once the script attempts to "print (data)". import socket target_host = "127.0.0.1" target_port = 80 client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print ("sending data") client.sendto(b"AAABBBCCC", (target_host, target_port)) print ("data sent") print ("recieving data") data, addr = client.recvfrom(4096) print ("data recieved") print (data) Any ideas on why?
5 Respostas
+ 1
Kyle Matthew Ford
Could you post also the server code?
+ 1
Kyle Matthew Ford I believe that, that's the problem.
+ 1
I'll create the server script and return if the problem persists
0
there is no server yet. This client script is all i've done so far. could that be the problem?
0
Ulisses Cruz
Would I be able to connect a UDP client to a TCP server? Or does my client have to also be TCP?