✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Português: No trabalho prático (leilões UDP), quando um lance é aceite por ser superior ao lance actual mais alto, o servidor deve transmitir a mensagem NEWHIGH <auctionID> <value> <bidder> a todos os participantes desse leilão.
Assumindo que o servidor mantém uma lista de estruturas com os endereços (IP e porta) de cada cliente inscrito num dado leilão, escreva um trecho de código em C (ou pseudocódigo) que percorra essa lista e envie a mensagem NEWHIGH a todos os participantes (incluindo ou não o próprio licitador – a decisão é sua, mas justifique brevemente). Utilize a função sendto() para UDP.
English: In the practical work (UDP auctions), when a bid is accepted because it is higher than the current highest bid, the server must broadcast the message NEWHIGH <auctionID> <value> <bidder> to all participants of that auction.
Assuming the server maintains a list of structures containing the addresses (IP and port) of each client subscribed to a given auction, write a code snippet in C (or pseudocode) that iterates over that list and sends the NEWHIGH message to all participants (including or not the bidder itself – your choice, but briefly justify). Use the sendto() function for UDP.
Nota: Não é necessário incluir o código completo do servidor, apenas a função ou o bloco que efetua o broadcast.Note: You do not need to include the full server code, only the function or block that performs the broadcast.