From: dave.joubert on

On the Wiki there is a page (http://wiki.tcl.tk/8493) that says:

Future direction
The following does only indirectly pertain to TclUDP. These are some
speculations on what a UDP package for tcl could look like.PT

There is some work on a version 2 udp package which will drop the
udp_open and udp_conf commands in favour of a single [udp] command for
creating the channel instance and then use the [fconfigure] command
for everything else.

As of udp 1.0.6 the fconfigure functionality is already in place.The
[udp] command will permit specification of the
local interface with a -myaddr option and also supports a -reuseaddr
flag to set the SO_REUSEADDR socket option so that multiple sockets
can bind an address.

Is there any life in a version 2 ?

I am trying to write a specialised DNS server, and the lack of -myaddr
and -reuseaddr means that there are problems on machines that have
multiple IP addresses.....

Is there an alternative to TclUDP ?

Dave
From: Frédéric Bonnet on
dave.joubert(a)googlemail.com wrote:
> On the Wiki there is a page (http://wiki.tcl.tk/8493) that says:
>
> Future direction
> The following does only indirectly pertain to TclUDP. These are some
> speculations on what a UDP package for tcl could look like.PT
>
> There is some work on a version 2 udp package which will drop the
> udp_open and udp_conf commands in favour of a single [udp] command for
> creating the channel instance and then use the [fconfigure] command
> for everything else.
>
> As of udp 1.0.6 the fconfigure functionality is already in place.The
> [udp] command will permit specification of the
> local interface with a -myaddr option and also supports a -reuseaddr
> flag to set the SO_REUSEADDR socket option so that multiple sockets
> can bind an address.
>
> Is there any life in a version 2 ?
>
> I am trying to write a specialised DNS server, and the lack of -myaddr
> and -reuseaddr means that there are problems on machines that have
> multiple IP addresses.....
>
> Is there an alternative to TclUDP ?

What a coincidence, I have exactly the same problem and was about to patch the
code so as to add SO_REUSEADDR support.

FYI I've been working on an UPnP AV media server these days. As of now my app
uses the libupnp library on Linux but I'm not entirely satisfied with it and was
about to rewrite the SSDP and HTTP/SOAP parts. SSDP uses UDP multicast for
announcement and discovery, and the lack of SO_REUSEADDR implies that it cannot
run on a machine with other clients or servers running.

However I find neither mention of SO_REUSEADDR nor -reuseaddr in the current
code base (1.0.8). But I believe the patch is trivial to write (just add the
proper arguments to udp_open).
From: Pat Thoyts on
"dave.joubert(a)googlemail.com" <dave.joubert(a)googlemail.com> writes:

>On the Wiki there is a page (http://wiki.tcl.tk/8493) that says:
>
>Future direction
>The following does only indirectly pertain to TclUDP. These are some
>speculations on what a UDP package for tcl could look like.PT
>
>There is some work on a version 2 udp package which will drop the
>udp_open and udp_conf commands in favour of a single [udp] command for
>creating the channel instance and then use the [fconfigure] command
>for everything else.
>
>As of udp 1.0.6 the fconfigure functionality is already in place.The
>[udp] command will permit specification of the
>local interface with a -myaddr option and also supports a -reuseaddr
>flag to set the SO_REUSEADDR socket option so that multiple sockets
>can bind an address.
>
>Is there any life in a version 2 ?
>
>I am trying to write a specialised DNS server, and the lack of -myaddr
>and -reuseaddr means that there are problems on machines that have
>multiple IP addresses.....
>
>Is there an alternative to TclUDP ?

I have a tcludp2 tree but its broken - I can see conflict markers in
the file. Basically as I didn't actually need to get that done it
eventually dropped off my todo list.

I've dropped the code (warts and all) at
http://www.patthoyts.tk/programming/tcludp2.zip
in case you want to see what can be extracted. It probably mostly is
ok iirc I got bogged down refactoring the address management. I
suspect the command interface reworking is ok which is what you want
for the additional options.

--
Pat Thoyts http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
From: Uwe Klein on
Fr�d�ric Bonnet wrote:
> What a coincidence, I have exactly the same problem and was about to
> patch the code so as to add SO_REUSEADDR support.

udp_open <port> reuse

ping ponged with Pat Thoyts, only tested for Linux.
patch provided somewhen in April 2007

###########from the past##################################
Patches item #1693037, was opened at 2007-04-02 16:03
Message generated for change (Comment added) made by patthoyts
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=543224&aid=1693037&group_id=75201

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None

>>Status: Closed
>>Resolution: Accepted

Priority: 5
Private: No
Submitted By: Uwe Klein (uklein)
Assigned to: Pat Thoyts (patthoyts)
Summary: port reuse

Initial Comment:
new option to udp_open "reuse"

like
udp_open 1234 reuse


only tested on linux.

patch is against 1.0.8

----------------------------------------------------------------------


>>Comment By: Pat Thoyts (patthoyts)

Date: 2007-04-10 13:20

Message:
Logged In: YES
user_id=202636
Originator: NO

Thinking on this more I realize that the proposed interface will not clash
with previous versions. We have never limited the number of args for
udp_open so there is no reason not to accept the patch. So I've applied it
-- it will be available in 1.0.9.

The planned replacement is in a branch called dev2 although I'm uncertain
how much might be on one of my hard disks. Actually I think it might all be
-- looks like a partial cvs merge at the moment.

----------------------------------------------------------------------

Comment By: Uwe Klein (uklein)
Date: 2007-04-10 07:39

Message:
Logged In: YES
user_id=136222
Originator: YES

Hi Pat,

>> I won't accept this pat

that is OK with me.

I had actually started out with changes
to get an unbound socket and then do
-reuse -bind -... in fconfigure.
But adding "reuse" to udp_open was
imho the better KISS.

Can one access your devel branch? tag?


----------------------------------------------------------------------

Comment By: Pat Thoyts (patthoyts)
Date: 2007-04-09 22:31

Message:
Logged In: YES
user_id=202636
Originator: NO

I won't accept this patch although I'll leave it open for a while in case
other people want to use this. My plan has been to gradually move the
interface of the udp package towards something that looks more like
[socket]/[fconfigure] hence all the newer features are accessed via
fconfigure on the channel. Now setting the SO_REUSEADDR has to be done
rather earlier than is possible using fconfigure as you have noticed so you
have done this as an option to the udp_open command which works ok. My plan
for udp 2 however is to have a [udp] command with options -myport, -myaddr,
-reuseaddr, -protocol which will permit selection of network interface,
port re-use and port number and the protocol. This is already in
development in a branch of the CVS tree although I've progressed this for a
while.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=543224&aid=1693037&group_id=75201



uwe
From: Frédéric Bonnet on
Uwe Klein wrote:
> udp_open <port> reuse
>
> ping ponged with Pat Thoyts, only tested for Linux.
> patch provided somewhen in April 2007

Great! It works fine with version 1.0.9 from Teapot. Tested on Linux, not yet on
Windows but from my experience it should work (SO_REUSEADDR behaves the same on
both platforms).

Txt, Fred