473,513 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Net.Socket issues and bugs (any of these fixed?)

Gurus

I didn't personally encounter these problems but some friends of mine
who are doing some deep heavy-metal C#/Networking application have run
into these problems. Does anybody have any idea if these are
addressed for a future release?

thanks
--Dilip

Problem report:
================
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.
Nov 15 '05 #1
2 1452
rd*****@lycos.com (Dilip) wrote in news:8bc3089c.0402111239.7e5ec89
@posting.google.com:
I didn't personally encounter these problems but some friends of mine
who are doing some deep heavy-metal C#/Networking application have run
into these problems. Does anybody have any idea if these are
addressed for a future release?


Have you considered using other socket sets? Or maybe just calling Winsock2
directly?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 15 '05 #2
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message >
Have you considered using other socket sets? Or maybe just calling Winsock2
directly?


Actually I don't know what workarounds were used in each of those
cases I listed. I didn't encounter these myself. But since we are
embarking on a networking project where we might use sockets heavily I
just thought I'd post it here and see if someone from MSFT responds on
whether they know about these issues and if they would be fixed in the
future.
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4935
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
4
11725
by: Bryan Olson | last post by:
Here's the problem: Suppose we use: import socket f = some_socket.makefile() Then: f.read() is efficient, but verbose, and incorrect (or at least does not play will with others);
2
2235
by: Boniface Frederic | last post by:
Hello, I need to check if a user has properly open his port on his computer. He will call a script specifing the port he want to use and the script will have to check if he can open a socket on...
1
17046
by: Frank Jones | last post by:
When I call Dns.GetHostByName(Dns.GetHostName()) on one of our lab boxes I get the below exception. I've seen posts saying others in these newsgroups have seen similar issues since moving to .Net....
1
2927
by: Andrew Arace | last post by:
Hi, I'm wondering what the industry practices are for socket and internet programming. Can you provide any links to good articles on network application architecture? I have found many tutorials,...
1
8156
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
9
2141
by: Irmen de Jong | last post by:
Hi, Recently I was bitten by an apparent bug in the BSD socket layer on Open VMS. Specifically, it appears that VMS defines MSG_WAITALL in socket.h but does not implement it (it is not in the...
10
3544
by: John Nagle | last post by:
Here are three network-related exceptions. These were caught by "except" with no exception type, because none of the more specific exceptions matched. This is what a traceback produced: 1....
1
2631
by: Tenowg | last post by:
Hey everyone... Firstly let me tell you this is a project that is probably alittle over my head... I have played with programming most of my life, but I have only been doing VB 2005 for about 2...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7106
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7534
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.