Go Back   ZeroC Forums > Comments

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-04-2004
vukicevic vukicevic is offline
Registered User
 
 
Join Date: May 2003
Location: San Francisco
Posts: 34
C# implementation issues?

Marc mentioned the following in another thread and suggested starting a new thread:
Quote:
There are several issues with some C# libraries being very buggy, such as the network library. For details, you must wait until Michi is back, he is on travel and will be back at the end of next week.
I'm interested in finding out what problems you're running into, especially so that I can check if the same problems are present in mono -- I'm assuming you're working with the Microsoft CLR.

Thanks!
__________________
vladimir@pobox.com
Reply With Quote
  #2 (permalink)  
Old 02-04-2004
rdilipk rdilipk is offline
Registered User
 
Name: Dilip Ranganathan
Organization: 3M
Project: None
 
Join Date: Jul 2003
Location: Minnesota, USA
Posts: 35
Quote:
I'm interested in finding out what problems you're running into
+1. If the ZeroC gang has a record of all issues that you ran into while implementing Icicle (is that the name?) it'd be invaluable for upstart projects like ours.

Apologies since this thread has nothing to do with ICE per se.
Reply With Quote
  #3 (permalink)  
Old 02-07-2004
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 889
I ran into a few problems in the .NET socket implementation:

1) If you put a socket into non-blocking mode, you cannot retrieve the local and the remote endpoint. (The LocalEndpoint and RemoteEndpoint attributes are null when you read them.) To fix, you have to use platform invoke for getsockname() and getpeername(), which is messy.

2) Poll() blocks indefinitely if you pass a negative timeout (as it should). On the other hand, Select() silently treats a negative timeout the same as a zero timeout. The closest thing to a blocking Select() you can do is to pass IntMax. However, that gives you only about 5 and a half minutes, then the call times out. The work-around (restarting the select if it times out) is surprisingly complicated.

3) To set the receive or send timeout, you have to pass the timeout in milliseconds. However, Select() expects the timeout in microseconds. Not nice.

4) Reading from a non-blocking socket when no data is available doesn't return zero bytes but throws an exception instead. That's a royal pain: the exception that is thrown is SocketException, so there is no way to specifically handle timeouts. Instead, you have to get the underlying Win32 exception, read the error code, and see whether it is WSAEWOULDBLOCK. To boot, there are no definitions for the various error codes in the .NET framework, so you end up grepping through the Windows header files and have to put manifest constants into the code. And, of course, the whole design is broken because having to handle an exception for something that isn't an error condition makes a mess of the code.

5) I had some issues with non-blocking sockets and select -- on occasion, select would return a socket in the error set even though it shouldn't. I didn't follow up on exactly what caused this because it was easier to just reorganize my code, so I can't provide more detail.

Cheers,

Michi.
Reply With Quote
  #4 (permalink)  
Old 02-09-2004
Ctaesis Ctaesis is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 10
I'm curious about which way you choose to solve the problems, write a custom wrapper around the underlying unmanaged Winsock functions and use that for the Ice implementation, or build the Ice implementation with the workarounds for the System.Net.Sockets bugs?

I suppose I could just wait for the source code release, and check myself, but um, call me impatient?
Reply With Quote
  #5 (permalink)  
Old 02-11-2004
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 889
For the getpeername() and getsockname() problem, I ended up calling into the Windows DLLs using platform invoke. (Not easy, BTW -- the documenation for platform invoke is, well, let's say "obtuse.")

For the other issues, I wrote a wrapper to get the behavior I wanted.

Cheers,

Michi.
Reply With Quote
  #6 (permalink)  
Old 02-11-2004
rdilipk rdilipk is offline
Registered User
 
Name: Dilip Ranganathan
Organization: 3M
Project: None
 
Join Date: Jul 2003
Location: Minnesota, USA
Posts: 35
Quote:
the documenation for platform invoke is, well, let's say "obtuse."
Actually you are being charitable. Obtuse is an understatement for P/Invoke related stuff. If you are interested you can check this out:
http://msdn.microsoft.com/msdnmag/is...T/default.aspx

Of course, since I have succesfully OT'ed this whole thread pls let me know if I should take it elsewhere.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
issues about IceGrid? richardma Help Center 3 01-23-2006 04:24 AM
MacOS 10.3 compile issues StuartA Help Center 2 05-10-2005 04:59 AM
Build Issues - gcc on Solaris acbell Comments 2 03-30-2005 04:13 PM
requirements issues mschulze Help Center 3 06-30-2004 10:39 AM
Documentation issues Ivan Bug Reports 32 03-22-2003 05:41 PM


All times are GMT -4. The time now is 03:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.