Skip to contentSkip to conversation

write() udp socket

DISCUSSION ZHOU Xiaobo 1 participant 1 message Jul 26, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

------------------
Sincerely yours
ZHOU Xiaobo

------------------ Original ------------------

From:  "Rick Jones"<[email protected]>;
Date:  Tue, Jul 26, 2011 01:38 AM
To:  "Huajun Li"<[email protected]>;

Cc: "ZHOU Xiaobo"<[email protected]>; "netdev"<[email protected]>;
Subject: Re: write() udp socket

Quoted 6 lines · Huajun Li

2011/7/23 ZHOU Xiaobo<[email protected]>:

Quoted 5 lines

question No1:
When I call
ssize_t write(int fd, const void *buf, size_t count);

Quoted 7 lines
Quoted 3 lines

on a nonblocking UDP socket, is the return value always equal to 'count'?

I don't think so. The function may be interrupt by signal or return due to other reason, so the return value only represents the size it writes successfully to the fd.

I believe it should either appaear to succeed or fail. write() best not be sending partial UDP datagrams. That would be "bad."

yeah, the same as I think. If so the answer of Question No.2 is 'yes' too?