bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [GSoC Update] Week 2


From: Tim Rühsen
Subject: Re: [Bug-wget] [GSoC Update] Week 2
Date: Sat, 17 Jun 2017 10:36:34 +0200
User-agent: KMail/5.2.3 (Linux/4.9.0-3-amd64; KDE/5.28.0; x86_64; ; )

On Samstag, 17. Juni 2017 13:53:06 CEST Didik Setiawan wrote:
> On Tue, Jun 13, 2017 at 06:37:27PM +0200, Darshit Shah wrote:
> > >   - http_server_port still hardcoded.
> > 
> > This is important. The port should be a random number. Usually, passing 0
> > in the port number makes the kernel choose an open one for you.
> > 
> > Having a randomised port is important to ensure that multiple runs don't
> > step on each other.
> 
> I still don't know how to accomplish this. Maybe, it just my understanding
> that when I pass 0 in MHD port number, the result is still 0.
> Another approach, when I look into the old code, it generate port number by
> calling wget_tcp_get_local_port(). But, I need to call wget_tcp_init() and
> wget_tcp_listen() respectively in order to get proper result.
> Conclusion, do I need to use existing wget_tcp_get_local_port() to get the
> port, or maybe there is a function in MHD to do that?

All you need is the socket descriptor. How to call getsockname() + 
getnameinfo() to retrieve the port number you see in libwget/net.c/
wget_tcp_get_local_port().

If MHD doesn't have such a function, either try to get the socket descriptor 
or extend MHD with a small function (similar code as in  
wget_tcp_get_local_port).

Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]