473,249 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,249 software developers and data experts.

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 1439
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
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
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
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
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
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
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
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
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
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
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.