Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UDP in C++ in Linux [closed]

Tags:

c++

linux

udp

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

like image 436
Saeed Avatar asked Jan 22 '23 01:01

Saeed


2 Answers

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.

like image 190
Robel Sharma Avatar answered Jan 31 '23 06:01

Robel Sharma


Using boost::asio.

like image 39
chris Avatar answered Jan 31 '23 08:01

chris