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 12-15-2004, 05:30 AM   #1
vadiml
Member
 
Registered: Oct 2003
Posts: 44

Rep: Reputation: 19
missign error return from readfrom


Hello,

I'm using sendto call to send data from app1 to app2 to running on same (or sometimes different machine).... and doing recvfrom to read a responce

I've read inte linux man pages, that if there is no application on the listening on destination port
the sending socket is marked so when i do recvfrom i'm supposed get a -1 ret value and error number in the errno....

so i'm shutting down the app2, and causing app1 send the data.... I see in ethereal the ICMP port unreachable message comming back in answer to the data packet....

but recvfrom does not getting an error code.... i've tried to do select with error fd_set nonempty
and select simply sits waiting there ad infinitum....


Any ideas what i'm doing wrong, i really want to avoid to use some kind of heartbeat protocol to detetct missing remote application....


Thanks

Vadim
 
Old 12-15-2004, 07:02 AM   #2
yrraja
Member
 
Registered: Sep 2002
Distribution: RH, FC, Ubuntu, Solaris, AIX
Posts: 114

Rep: Reputation: 15
It seems u r using UDP for your communication. In UDP u normally dont get back ICMP errors.. this is why although ur machine receives ICMP port unreachable message it is not communicated back to u.

You should either use TCP or u should use 'connected UDP'. U can find more information on this from Richard Stevens book "Unix Network Programming"
 
Old 12-15-2004, 10:59 AM   #3
vadiml
Member
 
Registered: Oct 2003
Posts: 44

Original Poster
Rep: Reputation: 19
Thanks for the reply,

You're right i'm using UDP, but this stuff should work and actually works with UDP too...
After browsing linux kernel, i've found that after i use 'connect' api on the socket, the kernel will report an error on 'recv' following the ICMP message reception


Thanks
Vadim
 
  


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
parse error before ; and } and , and return gogettergary Programming 4 05-12-2005 05:20 AM
Error when trying to run ET:Return to Castel Wolfenstein lilrowdy18 Linux - Software 5 01-28-2005 02:01 AM
Why the RPC request return error? liyuheu Red Hat 3 10-17-2004 11:38 PM
Why the RPC request return error? liyuheu Linux - Newbie 3 08-06-2004 11:31 PM
PHP Function to return the most recent error. id10t Programming 5 05-30-2004 06:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:56 AM.

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
Open Source Consulting | Domain Registration