ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Python实现UDP包编程

Python实现UDP包编程

原创 Linux操作系统 作者:jieforest 时间:2012-10-23 19:02:25 0 删除 编辑
UDP or user datagram protocol is an alternative protocol to its more common counterpart TCP. UDP like TCP is a protocol for packet transfer from 1 host to another, but has some important differences. UDP is a connectionless and non-stream oriented protocol. It means a UDP server just catches incoming packets from any and many hosts without establishing a reliable pipe kind of connection.

In this article we are going to see how to use UDP sockets in python.

Create udp sockets

A udp socket is created like this

CODE:

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)The SOCK_DGRAM specifies datagram (udp) sockets.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/301743/viewspace-747039/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    441
  • 访问量
    602329