Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed 2 lines for mono compatibility #24

Closed
wants to merge 1 commit into from

Conversation

martindevans
Copy link
Contributor

Running the CoAP.Example/CoAP.Client on Linux (using mono 4.0.1) crashes with an exception: "Failed Executing Request: The Descriptor Is Not A Socket", this is caused by the lines which I have removed (commented out).

All three example projects now run under Mono :)

Running CoAP.Example/CoAP.Client on Linux (using mono 4.0.1) crashes with an exception: "Failed Executing Request: The Descriptor Is Not A Socket", this is caused by the lines which I have removed (commented out).

All three example projects now run under Mono :)

Signed-off-by: Martin Evans <martindevans@gmail.com>
@longshine
Copy link
Member

Hi~

Thanks for your work, but these two lines are added to fix issue #9.
If commented out, unexpected exceptions may occur.
Please refer to the issue for more detail.

We may wrap these codes with a try...catch clause and drop
the potential exception.

const Int32 SIO_UDP_CONNRESET = -1744830452;
try
{
  socket.Socket.IOControl(SIO_UDP_CONNRESET, new Byte[] { 0 }, null);
}
catch 
{
  // ignore
}

However, if fails to set SIO_UDP_CONNRESET option, the issue #9 still
exists (in Mono). Could you please propose another way to set this option?

@martindevans
Copy link
Contributor Author

It looks like the correct solution would be the one proposed on issue #9 - catch the exception when you send. You could possibly cancel the observation at that point too.

@longshine
Copy link
Member

Yes you're right : ). That's the exception we should actually handle.
However, it's a pity that there is no easy way for underlying UDP exceptions
bubbling up in current layer structure. As you can find in UDPChannel class,
exceptions are silently ignored by now:

private void EndReceive(UDPSocket socket, Exception ex)
{
  // TODO may log exception?
  BeginReceive(socket);
}

Without knowing the error occurs, the observation cannot be cancelled.
In fact, observations are cleaned up by timeouts of CONs.

We are trying to figure this issue out, and you are totally welcome if you
have any advice, but for now we are sorry to say that we have to keep
these two lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants