Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1110
  • Last Modified:

fcntl in udp socket

i have a udp socket that uses fcntl to create a non blocking socket. However , i am getting my packets with delay even though i have cleared the non blocking flag before setting it up . any help will be appreciated.
1 Solution
Another possibility to enable non-blocking I/O for your sockets is...

#include <sys/ioctl.h>

int value = 1;
if ( ioctl(file_descriptor_here, FIONBIO, &value) == -1) {
      /* handle error */

Non-blocking I/O doesn't mean there won't be any delay in the transmission
but that when data is received, a call won't cause your program to wait idle
(stay in the read/write call) to await everything to come in before returning control to the program.

Even with non-blocking I/O it may be needed to wait for info to arrive with an event loop using
select() or poll() to wait for writability / waiting input..
Hi webusername,

Can you elaborate your query a bit?

>create a non blocking socket.
please post those few lines of code where you have done this

>However , i am getting my packets with delay even though i have cleared the non blocking flag before setting it up .
How did you know there was a delay? As Mysidia pointed out, non-blocking sockets simply means that your read and write calls to that socket will not block for completion. Rather if for some reason, request cannot be satisfied at that time, they will return with error numer EAGAIN.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now