From owner-freebsd-questions Tue Jul 31 4:55:10 2001 Delivered-To: freebsd-questions@freebsd.org Received: from pluton.ispras.ru (pluton.ispras.ru [194.186.94.6]) by hub.freebsd.org (Postfix) with SMTP id C9DC137B401 for ; Tue, 31 Jul 2001 04:54:56 -0700 (PDT) (envelope-from grn@ispras.ru) Received: (qmail 55137 invoked from network); 31 Jul 2001 11:52:40 -0000 Received: from unknown (HELO gate.ispras.ru) (194.67.37.200) by pluton.ispras.ru with SMTP; 31 Jul 2001 11:52:40 -0000 Received: from ispgate (ispgate [194.67.37.200]) by gate.ispras.ru (8.11.2/8.11.1) with ESMTP id f6VBsZA07110 for ; Tue, 31 Jul 2001 15:54:37 +0400 (MSK) Date: Tue, 31 Jul 2001 15:54:35 +0400 (MSK) From: Grigory Kljuchnikov To: Subject: How can I get udp socket error status Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, I'm making udp echo server and client for some testing purpose. They work properly, but I don't know how application can get ICMP error (for example after sendto() - ICMP_UNREACH, if there isn't server process on remote side) for appropriate udp socket. I've tried: ---- sockfd = socket(AF_INET, SOCK_DGRAM, 0); bind(sockfd, (struct sockaddr *) &cli, sizeof(cli)); if (sendto(sockfd, sendline, n, 0, pserv_addr, servlen) != n ) { perror("sendto error"); exit(-1); } sleep(1); getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &stat, &n); ----- but 'stat' always = 0 (no error). I think sendto() doesn't wait an error and ICMP_UNREACH don't affect to the socket. In Solaris there is an option: SO_DGRAM_ERRIND application wants delayed error that makes it possible to receive errors for datagram sockets that are not connected. My question is how application can get errors from ICMP for connectionless socket after sending a packet to the server? I don't subscribe to the maillist, please reply to my mail address grn@ispras.ru! Thank you. Grigory Klyuchnikov, System Engineer, Institute for System Programming Russian Academy of Sciences To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message