[YBA] When does write to UDP socket block?
Shawn
citypw at gmail.com
Thu Mar 8 09:55:51 IST 2012
hey Shachar,
2012/3/7 Shachar Shemesh <shachar at shemesh.biz>:
> On 03/07/2012 07:27 AM, Jonathan Ben Avraham wrote:
>
> Hi linux-il colleagues,
> In >= 2.6.31 are there any conditions under which a write to a connected UDP
> socket can block? e.g. some change in routing or iface config after connect
> and before write?
udp socket doesn't need to use connect() but instead of sendto()
> Has anyone encountered a concrete exampe of a write to a
> UDP socket that blocks? See test code below. That is, I am trying to
> demonstrate that I can get to a situation where UDP write in fact does
> block.
>
You might be interested in some sample code of tcp/udp socket:
https://github.com/citypw/SCFE/tree/master/networking/userspace_socket
> if (0 > (rc = connect(sd, (const struct sockaddr*)&serveraddr,
> sizeof(serveraddr)))) {
> printf("connect failed [%m]");
> exit(1);
> }
>
I think you have written a tcp socket program. Am I right?
--
GNU powered it...
GPL protect it...
God blessing it...
regards
Shawn
More information about the Linux-il
mailing list