From nobody@FreeBSD.ORG Thu Jun 3 23:13:33 1999 Return-Path: Received: by hub.freebsd.org (Postfix, from userid 32767) id 2139D1509E; Thu, 3 Jun 1999 23:13:33 -0700 (PDT) Message-Id: <19990604061333.2139D1509E@hub.freebsd.org> Date: Thu, 3 Jun 1999 23:13:33 -0700 (PDT) From: jainp@accsoft.com.au Sender: nobody@FreeBSD.ORG To: freebsd-gnats-submit@freebsd.org Subject: Getting Error Can't Assign requested address while using UDP X-Send-Pr-Version: www-1.0 >Number: 12019 >Category: kern >Synopsis: Getting Error Can't Assign requested address while using UDP >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 3 23:20:00 PDT 1999 >Closed-Date: Wed Jun 9 17:20:03 PDT 1999 >Last-Modified: Wed Jun 9 17:21:00 PDT 1999 >Originator: Pawan Jain >Release: Vresion 3.1 Release Generic >Organization: Commonwealth Bank of Australia >Environment: Intel 486 DX hardware >Description: Hi, I am facing a problem while using UDP on FreeBSD Operating System. I am using a test program to test a SNMP Agent. The test program and agent both run on the same box. The test program uses local port 2000. The SNMP Agent program listens on port 3000. (I will change these port numbers later as per SNMP standard). When the test program tries to send data to SNMP Server using sendto command ("127.0.0.1" , port 3000), it receives the error "Can't assign requested address" The same two programs work when run on an HP machine. The code used by test program as below: =============================================== if( (sk = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { perror("Error in socket"); exit (errno); } /* bind a local port Number */ cln_addr.sin_family = AF_INET; cln_addr.sin_addr.s_addr = inet_addr(INADDR_ANY); cln_addr.sin_port = htonl(2000); if ( bind(sk, &cln_addr, sizeof(struct sockaddr_in)) == -1) { perror("Local Bind error:"); exit (-1); } srvsnd_addr.sin_family = AF_INET; srvsnd_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); srvsnd_addr.sin_port = htonl(3000); fromlen = sizeof(struct sockaddr_in); .... code to prepare the Network Management request /* send request to agent */ sndsts = sendto(sk, reqbuf , reqSize , 0, &srvsnd_addr, sizeof(struct sockaddr_in)); if (sndsts == -1) { perror("Send Error"); exit (-1); } =================================================== The error is flagged from sendto call. I am using FreeBSD V3 >How-To-Repeat: It is persistant behaviour. >Fix: Not known >Release-Note: >Audit-Trail: From: Gregory Bond To: freebsd-gnats-submit@freebsd.org, jainp@accsoft.com.au Cc: Subject: Re: kern/12019: Getting Error Can't Assign requested address while using UDP Date: Mon, 07 Jun 1999 17:42:26 +1000 > cln_addr.sin_addr.s_addr = inet_addr(INADDR_ANY); After trying this as cln_addr.sin_addr.s_addr = INADDR_ANY; Pawan reports that his test program works. The PR can be closed. Greg, Not a comitter! State-Changed-From-To: open->closed State-Changed-By: steve State-Changed-When: Wed Jun 9 17:20:03 PDT 1999 State-Changed-Why: This problem has been resolved. >Unformatted: