LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 10-15-2004, 04:37 AM   #1
trotters78
LQ Newbie
 
Registered: Aug 2004
Location: Japan
Distribution: Fedora Core 2/ FreeBSD 4.9
Posts: 12

Rep: Reputation: 0
Using write fn for sockets in both BSD and Linux


Hi,

With reference to the book UNIX Network Programming by W.Richard Stevens:

In section 17.3 under "Step to next socket address structure".

/******************************************************

The author stated that :
" For example if we are deleting a route, a return of 0 from write means sucess, while an error return of ESRCH means the route could not be found."

*******************************************************/

Using the same scenario, I tried to delete a non existance route.
I have tried it on both FreeBSD and Linux using Netlink sockets and routing sockets respectively.

ret = write(sk, rtm, all_size);

FreeBSD's "WRITE function" returns a -1 and errno = ESRCH.
Linux's "WRITE function" returns the lenght of data sent and errno = 0.
But the nlmsgerr acknowledged from Linux contains the correct errno.

It is obvious that Linux is aware of the error.
But why is it that Linux "WRITE function" does not reflect the error?


I will be happy to re-explain my question.
Any help rendered will be helpful.
Thanks in advance.


Daryl
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java - sockets ok in Linux, not Win? rylan76 Programming 6 09-05-2005 02:33 AM
Linux Sockets JanusPaul Programming 5 11-14-2004 12:44 PM
Linux sockets linlai Programming 2 07-16-2002 03:51 PM
sockets in linux 2.4.2 kernel arumash Linux - Networking 1 06-29-2002 10:21 PM
Sockets in Linux GhostBoot Linux - Networking 1 05-18-2001 01:36 PM


All times are GMT -5. The time now is 03:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration