[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Wed, 1 Aug 2001 10:10:55 +0200 (CEST)
>From owner-rtl Tue Jul 31 09:21:04 2001
Received: from huey.jpl.nasa.gov (huey.jpl.nasa.gov [128.149.68.100])
by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f6VFL3732281
for <rtl@fsmlabs.com>; Tue, 31 Jul 2001 09:21:03 -0600
Received: from huey (huey [128.149.68.100])
by huey.jpl.nasa.gov (8.8.8+Sun/8.8.8) with ESMTP id IAA15828
for <rtl@fsmlabs.com>; Tue, 31 Jul 2001 08:20:53 -0700 (PDT)
Date: Tue, 31 Jul 2001 08:20:53 -0700 (PDT)
From: GEORGE Y SUN <geosun@huey.jpl.nasa.gov>
To: rtl@fsmlabs.com
Subject: Re: [rtl] Off Topic - Ethernet releasing port addresses
In-Reply-To: <20010730233542.A6427@ifr.ing.tu-bs.de>
Message-ID: <Pine.GSO.4.10.10107310814490.15506-100000@huey.jpl.nasa.gov>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Mon, 30 Jul 2001, Kai Mueller wrote:
> On Mon, Jul 30, 2001 at 07:51:43AM -0700, Estabridis, Janet P wrote:
> [...]
> > Unable to establish a port Connection: Address already in use.
>
> I received this message many times. I didn't understand it
> completely but it seems to be a timer in the tcp stack code
> which allocates a released port a certain amount of time
> (perhaps to allow a reconnection of a broken connection).
>
> No need to reboot. Just wait a few seconds.
>
Hi,
I remember having an error like this in my network programming class (in
unix), and this is what one of my classmates had put up for us to use. (I
might be totally off on the correct solution, but we were doing socket
programming as well).
int sockfd, i = 1;
if ((sockfd = socket(AF_INET,SOCK_STREAM,0))==-1)
{
perror("socket");
}
setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,(void*)&i,sizeof(i));
^^^^^^^^^^^^^^^^^^^
***
That line seemed to do the trick. I don't really know what the i
variable is for (I was just happy that my problem was solved). I had been
getting the port still in use error, and that line fixed it up for me.
***
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(atoi (argv[1]));
server_addr.sin_addr = *((struct in_addr *) he->h_addr);
if (connect (sockfd, (struct sockaddr *) &server_addr, sizeof (struct
sockaddr)) == -1)
{
perror ("connect");
exit (-1);
}
close (sockfd)
Hope that helps!
George Sun
----- End of forwarded message from owner-rtl@fsmlabs.com -----