Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Sento() system call: (2 Items)
   
Sento() system call  
Hello friends.

We work with Qnx 6.4.0  and have a question about sendto() systemcall.  Our system consists of two computers  which 
exchange data via network using a udp protocol and port number 5000.  Each 5 seconds it exchange by special keepalive 
packets.  My question is………..

Why first computer continue to send this packets even so program on the second computer is terminated????? Why  sendto()
 system call don't return the error «destination port unreachable» ???

We invoke tcpdump on the first computer and see icmp packet «destination port unreachable», but first computer 
continue to send this packets…….And we see that this packets is arrived to the second computer………….When  invoke 
netstat –a on the second computer (where we terminate a program) we don’t  see port 5000 as open. 
Re: Sento() system call  
UDP is connectionless, hence there is no such thing.
So, You have to handle such case by hand :-)
You can implements a 'disconnect' message to send from one side to the other
to do a clear disconnection, or You can add a hert-beat messages every xx seconds 
to be sure connection is still up....
Or You can use a TCP/IP socket paired to Your UDP socket used for low trafic data, and other stuffs: 
If the TCP side of the connection disconnects, it's safe  to assume the UDP connection did too.
bye
M.Sangalli