In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how python uses VS to receive data. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
1. Use the recvfrom function.
S.recvfrom (1024)
2. When the program is running, it will block and wait for data to be received. 1024 represents the maximum number of bytes that can be received this time.
The program should s.close () after receiving it.
3. Because the object s takes up a certain amount of space, when it is not used, it should be closed in time.
The code is as follows:
From socket import * # Import module addr = ("192.168.0.106", 8080) # prepare the address of the receiver s = socket (AF_INET,SOCK_DGRAM) s.sendto ("Hello duck" .encode ("gb2312"), addr) # send content, convert to byte stream redate = s.recvfrom (1024) print (redate) s.close () on "how python uses VS to receive data", this ends here. Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.