> int optval =1;
> setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *) &optval, sizeof(optval)))
> <0);
>
> But execution gives the following error: address already in use
>
> I have read with: man 7 socket
> in paragraph SO_REUSEADDR that
> with SO_REUSEADDR a socket may bind, except when there is an active
> listening socket bound to the address. When the listening socket is bound to
> INADDR_ANY with a specific port then it is not possible to bind to this
> port.
I think your problem here is you have the old processes which still
attachted to port. Kill them first, then rerun your program
> But I can listen on the same udp port P using the following tcpdump command:
>
> /usr/sbin/tcpdump udp port P
> tcpdump can listen on this port while there is another active loistening
> socket on the same port P.
>
> I would like to hnow how to bind and then listen on a udp port P, while
> there is another active socket on the same port.
UDP and TCP port numbers are different. You can use same number for both I
think. and UDP doesn't need listen() to, it is
non-connection-oriented.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe