Issue 7338 - Non-blocking socket.accept() behavior differs on platforms
Summary: Non-blocking socket.accept() behavior differs on platforms
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-21 10:47 UTC by Heywood Floyd
Modified: 2024-12-01 16:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Heywood Floyd 2012-01-21 10:47:02 UTC
// - - - - - 8< - - - - 
import	std.stdio, std.socket;
void main()
{
	auto lsock = new TcpSocket();
	lsock.blocking(false);
	lsock.bind(new InternetAddress("127.0.0.1",5000));
	try{
		lsock.listen(1);
	}catch(Exception e){
		writeln("listen() failed (This is not the bug, choose another port?)");
		return;
	}

	try{
		auto sock = lsock.accept();
		writeln("Accept returned: ",sock);
	}catch(Exception e){
		writeln("Accept threw Exception:\n",e);
	}

	lsock.close();
}
// - - - - - 8< - - - -

Behavior when socket.accept() is called when no new connection is available:

- Linux, OSX: An Exception is thrown
- Windows: A new Socket(isAlive=false) is returned
- Other: <untested>
Comment 1 berni44 2019-10-17 19:42:31 UTC
What is the expected correct behavior?
Comment 2 dlangBugzillaToGithub 2024-12-01 16:14:47 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9587

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB