ObjFW  Check-in [1724525754]

Overview
Comment:OFHTTPServer: Allow binding to port 0

This allows binding to a random port and calling [server port] to get
the port used.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 172452575407e5a5ed9afee9602503df6c42a0ffe42c92e4d3cedf4ae4f30963
User & Date: js on 2014-02-11 14:44:03
Other Links: manifest | tags
Context
2014-02-12
00:10
Add property introspection check-in: bb26fbe4b8 user: js tags: trunk
2014-02-11
14:44
OFHTTPServer: Allow binding to port 0 check-in: 1724525754 user: js tags: trunk
2014-02-10
19:29
Move OFBigDataArray out to its own files check-in: af7e24f9ab user: js tags: trunk
Changes

Modified src/OFHTTPServer.m from [2f642831d8] to [3104ed8898].

682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
- (OFString*)name
{
	OF_GETTER(_name, true)
}

- (void)start
{
	if (_host == nil || _port == 0)
		@throw [OFInvalidArgumentException exception];

	if (_listeningSocket != nil)
		@throw [OFAlreadyConnectedException exception];

	_listeningSocket = [[OFTCPSocket alloc] init];
	[_listeningSocket bindToHost: _host
				port: _port];
	[_listeningSocket listen];

	[_listeningSocket asyncAcceptWithTarget: self
				       selector: @selector(OF_socket:
						     didAcceptSocket:
						     exception:)];
}







|






|
|







682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
- (OFString*)name
{
	OF_GETTER(_name, true)
}

- (void)start
{
	if (_host == nil)
		@throw [OFInvalidArgumentException exception];

	if (_listeningSocket != nil)
		@throw [OFAlreadyConnectedException exception];

	_listeningSocket = [[OFTCPSocket alloc] init];
	_port = [_listeningSocket bindToHost: _host
					port: _port];
	[_listeningSocket listen];

	[_listeningSocket asyncAcceptWithTarget: self
				       selector: @selector(OF_socket:
						     didAcceptSocket:
						     exception:)];
}