Overview
Features
Download
Documentation
Community
Add-Ons & Services

bind a StreamSocket to local port?

Please post support and help requests here.

bind a StreamSocket to local port?

Postby jimfr » 17 Apr 2009, 03:40

How can I bind a StreamSocket to a particular local port? For example, an FTP server wants to use local port 20 as the outgoing port for ACTIVE mode data transfers. Looking at the API it appears that only the ServerSocket class can do a bind?
jimfr
 
Posts: 8
Joined: 05 Mar 2009, 01:58

Re: bind a StreamSocket to local port?

Postby jimfr » 23 Apr 2009, 20:38

Would it be possible to add a new method bind()so it can bind the socket to a local port before connect() is called? Without something like this change, I don't see a way to write an FTP server using Poco.
jimfr
 
Posts: 8
Joined: 05 Mar 2009, 01:58

Re: bind a StreamSocket to local port?

Postby guenter » 23 Apr 2009, 21:35

With the new 1.3.4 release you should be able to bind() a StreamSocket before a connect(). This was not possible in earlier versions.
guenter
 
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: bind a StreamSocket to local port?

Postby jimfr » 24 Apr 2009, 01:29

I just now looked at the 1.3.4 header files for StreamSocket, but I don't see a way to do a bind. Could you let me know how to do this? thanks
jimfr
 
Posts: 8
Joined: 05 Mar 2009, 01:58

Re: bind a StreamSocket to local port?

Postby guenter » 24 Apr 2009, 05:25

Use Socket::impl() to obtain the underlying SocketImpl object, then call bind() on that.
guenter
 
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron