Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 10-15-2004, 03:37 AM   #1
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


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.



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 01:33 AM
Linux Sockets JanusPaul Programming 5 11-14-2004 11:44 AM
Linux sockets linlai Programming 2 07-16-2002 02:51 PM
sockets in linux 2.4.2 kernel arumash Linux - Networking 1 06-29-2002 09:21 PM
Sockets in Linux GhostBoot Linux - Networking 1 05-18-2001 12:36 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:27 AM.

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