Python send UDP packet

前端 未结 5 1820
盖世英雄少女心
盖世英雄少女心 2021-01-30 06:23

I am trying to write a program to send UDP packets, as in https://wiki.python.org/moin/UdpCommunication The code appears to be in Python 2:

import socket

UDP_I         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 07:06

    If you are running python 3 then you need to change the print statements to print functions, i.e. put things in brackets () after print statements.

    The only thing that you will see the above do is the prints unless you have something listening on 127.0.0.1 port 5005 as you are sending a packet not receiving it - so you need to implement and start the other part of the example in another console window first so it is waiting for the message.

提交回复
热议问题