Access Denied
Access Denied

Reputation: 224

Implementing Concurrency in udp servers

Is there any easy way to implement concurrency in udp servers. In TCP we have a connection which can be used to distinguish clients which is not the case in UDP. So is there any other way in which a client can be uniquely identified from another which is trying to connect to the server so that the server can fork a process for each new datagram which is from a new client. Or is there any alternative implementation without using forks

Upvotes: 0

Views: 541

Answers (2)

CrazyCasta
CrazyCasta

Reputation: 28362

You will need to look at the sockaddr struct that you pass a pointer of to recvfrom after recvfrom returns. That will tell you where the data's coming from.

Upvotes: 1

Some programmer dude
Some programmer dude

Reputation: 409404

Keep a list of already "connected" clients, and when a new datagram is received then check against this list.

Upvotes: 0

Related Questions