Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

288
Views
Are the C functions recvfrom and sendto mutually exclusive?

I have one thread calling recvfrom with a timeout of 100 ms in a loop. Another thread calls sendto periodically.

Does the sendto function wait until the recvfrom is released by the timeout (or a successful read) or does it send the data during that period of time.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Are the C functions recvfrom and sendto mutually exclusive?

No. They can both be executed by different threads at the same time.

sendto() doesn't wait for recvfrom() to read the data. It would place the data into the socket's buffer and return. Multiple sendto() may block for the previous sendto() to complete. If any error occurred (buffer full, message too big etc) while sending then you can check inspect errno to check the cause of failure. Basically, you don't need to do any synchronization between sendto() and recvfrom() calls from the two threads; they are atomic operations.

over 4 years ago · Santiago Trujillo Report

0

No, it does not wait, (at least, it does not wait any longer than necessary to gain thread-safe access to the comms stack).

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!