开发者

UDP in C++ in Linux [closed]

开发者 https://www.devze.com 2023-01-25 18:27 出处:网络
Clo开发者_运维百科sed. This question needs to be more focused. It is not currently accepting answers.
Clo开发者_运维百科sed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question

How to send and receive, using UDP, in C++ in Linux? I use g++


Ok it's preety simple. I was workig in CentOS 5.5 which is linux and i make a server-client programme based on udp in c.It runs well.

The procedure is simple. It follows as ..

**SERVER**

0.Variable initialization
1.sock()
2.bind()
3.recvfrom()
4.sendto()

**CLIENT**

0.gethostbyname()
1.sock()
2.bzero()
4.sendto()
5.recvfrom()

You will understand the code if you see the documentation.

If its not work that way then go to >> matrixsust.blogspot.com for source.


Using boost::asio.


You can use Berkeley Sockets API.

0

精彩评论

暂无评论...
验证码 换一张
取 消