简体   繁体   中英

Receiveing using Datagram socket in C

Since UDP is connectionless, is it possible for a single UDP socket/port on a client to receive packets from different servers(connections)? Or would it need separate connections to receive from each server?

I am designing a client which receives packets from 5 servers using UDP. Does this require me to create 5 sockets each on different ports on my client? Or can i receive data using a single port/socket at my client?

Any help would be appreciated. Thanks!

You can send and receive datagrams from multiple clients at the same time. for this you'd use sendto() and recvfrom() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM