Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#111] Socket.acceptNB returns somewhat broken sockets

Date:
2013-04-15 22:58
Priority:
3
State:
Closed
Submitted by:
Bug Submitter (webuser)
Assigned to:
Lars Bergstrom (larsberg)
Machine Architecture:
x86
Operating System:
Other
Component:
Basis Library
Resolution:
None
Severity:
Minor
OS Version:
Windows 7
SML/NJ Version:
110.74
Keywords:
socket
URL:
Transcript (of reproduction):
- Socket.recvVec (s, 1); uncaught exception SysErr [SysErr: win32 error code 10035 [OS.errorName unimplemented]] raised at: recv.c
Source (for reproduction):
val s = let val s = INetSock.TCP.socket () val () = Socket.bind (s, I.any 5555) val () = Socket.listen (s, 5) in s end (* someone else connects *) val (s, _) = valOf (Socket.acceptNB s); Socket.recvVec (s, 1)
Summary:
Socket.acceptNB returns somewhat broken sockets

Detailed description
When a socket is obtained using Socket.acceptNB, and then recvVec
is called on the resulting socket, the call does not block until
data is available. Instead, SysErr is raised if data is not
available.

If Socket.recvVecNB is used, it returns NONE, as desired. Also,
sockets obtained by Socket.accept seem to work fine.

Submitted via web form by Karl Crary crary@cs.cmu.edu

Comments:

Message  ↓
Date: 2013-06-04 16:56
Sender: Lars Bergstrom

Fixed by detecting the platform and setting the NB-status appropriately.

Date: 2013-05-31 18:10
Sender: Lars Bergstrom

On Windows, client sockets inherit the non-blocking and async status associated with the listening socket. So, we will need to reset it to blocking to conform with the rest of the codebase (and nice, normal Berkeley sockets conventions...).

Attached Files:

Changes

Field Old Value Date By
status_idOpen2013-06-04 16:56larsberg
close_date2013-06-04 16:562013-06-04 16:56larsberg
assigned_tonone2013-04-15 23:01larsberg