Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  3 Jun 1999 23:13:33 -0700 (PDT)
From:      jainp@accsoft.com.au
To:        freebsd-gnats-submit@freebsd.org
Subject:   kern/12019: Getting Error Can't Assign requested address while using UDP
Message-ID:  <19990604061333.2139D1509E@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun  3 23:20:00 PDT 1999
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990604061333.2139D1509E>