.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

.net4 TcpClient fails when NetworkStream.ReadTimeout is set

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
Hi, I have a problem implementing a Read() with timeout. I have a TcpClient obtained via listener: let listener = new TcpListener(IPAddress.Any, 6667) listener.Start() let client = listener.AcceptTcpClient() and I tried this code to have a Read with timeout: let stream = client.GetStream() stream.ReadTimeout <- 5000 try Some(stream.ReadByte()) with _ -> None which works fine. The problem is that, when the timeout happens, client.Connected becomes false !! And that's false because the socket is still alive and I'm still able to Write/Read data through the stream. Also, because client.Connected is false, I'm not able anymore to invoke the GetStream() method. I think this is a big bug, isn't it? Marco --------------------- Edit: I forgot to mention that it happens the same setting either  client.ReceiveTimeout  and/or  stream.ReadTimeout...

View Complete Post

More Related Resource Links

.NET Framework 4 installs, but .NET4 Applications won't run and verification fails

I have the same problem described in following thread: http://social.msdn.microsoft.com/Forums/en/netfxsetup/thread/d8601382-83a4-4039-a71b-3b68dcdc6e26 I'm running Windows 7 x64 Ultimate I installed the .NET Framework 4 Client Profile and even tried installing the FULL/Extended edition the install appears to go in just fine, no errors or anything. Once I try to run a program it fails to work, I tried to verify my .NET4 installation using this tool... http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx It ALWAYS fails the verification no matter how many times I uninstall/clean up and reinstall... Here is a snippet from the verifier log... .....[07/22/10,17:35:35] Section [Registry - .NET Framework 4 Full (Wow6432Node)] - stop parsing entries [07/22/10,17:35:35] Processing custom action 'Custom Action - .NET Framework 4.0 test application' [07/22/10,17:35:35] ExecutablePath = 'Netfx40TestApplication.exe' [07/22/10,17:35:35] FriendlyName = '.NET Framework 4 test application' [07/22/10,17:35:35] TimeoutSeconds = '300' [07/22/10,17:35:35] WaitOnExit = 'true' [07/22/10,17:35:35] Silent = 'true' [07/22/10,17:35:35] Launching process 'Netfx40TestApplication.exe' now [07/22/10,17:35:35] Process successfully launched. Waiting 300 seconds for it to complete. [07/22/10,17:35:35] ****ERROR**** Process 'Netfx40TestApplication.exe' exited with return

.NET Framework 4 installs, but .NET4 Applications won't run and verification fails

I seem to have the same problem as these good people, http://social.msdn.microsoft.com/Forums/en/netfxsetup/thread/58ff584d-e849-49e7-8c17-563296602017 http://social.msdn.microsoft.com/Forums/en/netfxsetup/thread/d8601382-83a4-4039-a71b-3b68dcdc6e26 .NET 4 installs (reporting no overt errors).. but will fail verification with this message. .NET 4 applications fail to run. [07/22/10,17:35:35] Launching process 'Netfx40TestApplication.exe' now [07/22/10,17:35:35] Process successfully launched. Waiting 300 seconds for it to complete. [07/22/10,17:35:35] ****ERROR**** Process 'Netfx40TestApplication.exe' exited with return code -2146232576 [07/22/10,17:35:35] ****ERROR**** Verification failed for product .NET Framework 4 Full I do get this event log error when installing .net 4.0 full version , but not the client. Of course neither one works. ErrorCode 2149842967   ErrorString    CommandLine wusa.exe "G:\e1781735b278c4779d6d\Windows6.1-KB958488-v6001-x64.msu" /quiet /norestart  Steps already taken to troubleshoot this include fully uninstalling .NET 4.0 and reinstalling (both client and full); reinstalling .NET 4.0 over itself with a repair install; installing .NET 4.0 full over a client install; I've also run full disk scans etc., and my system is fully up to date with Windows Updates. Any one know what that error code means? Maybe it can he

NetworkStream ReadTimeOut doesn't wait for the time out period



I am using the TCPClient and the NetworkStream classes to establish a TCP connection and read the data from the network.
The NetworkStream object is set with a time out of 15 sec. The intent is, if the stream can't see any data from the network within 15 sec,
it will throw an exception and return. Something like myStream.ReadTimeOut = 15000. I set this time out once in the beginning just after the TCP connection  and the NetworkStream are created.

Though majority of the times (70%) it behaves nice and waits for the time out period to expire before throwing the System.IOException,
other 30% of the times, it just doesn't wait 15 sec before throwing the exception. It doesn't even wait for 2-3 milliseconds before throwing the exception.

I verified this using another tool, wireshark to time and detect the traffic.

Is the NetworkStream object doing some kind of optimization? Or do I have to do anything special to make it to wait for 15 sec?


Tech Crawler


.NET Framework 4 installs, but verification fails and .NET4 Applications will not run.


Hi there


I have read through all of the threads for people who have had the same problems as myself and having followed all of the steps I still have no answer and the problem is still there.


I have uninstalled .net 4 and reinstalled it about 20 times. I have completed this with my anti virus off, as an administrator, after running the .net clean up tool and still have had no luck. Please help!!


This is the section of the log from the .net check program in which it fails:


[11/20/10,20:50:27] Section [Registry - .NET Framework 4 Full (Wow6432Node)] - stop parsing entries
[11/20/10,20:50:27] Processing custom action 'Custom Action - .NET Framework 4.0 test application'
[11/20/10,20:50:27] ExecutablePath = 'Netfx40TestApplication.exe'
[11/20/10,20:50:27] FriendlyName = '.NET Framework 4 test application'
[11/20/10,20:50:27] TimeoutSeconds = '300'
[11/20/10,20:50:27] WaitOnExit = 'true'
[11/20/10,20:50:27] Silent = 'true'
[11/20/10,20:50:27] Launching process 'Netfx40TestApplication.exe' now
[11/20/10,20:50:27] Process successfully launched. Waiting 300 seconds for it to complete.
[11/20/10,20:50:27] ****ERROR**** Process 'Netfx40TestApplication.exe' exited with return code -2146232576
[11/20/10,20:50:27] ****ERROR**** Verification

New Language features in .NET4.0

The site explains the new features and enhancement to VB.NET and C# in .NET framework 4.0. The new enhancements are described in detail with examples and code snippets. One can easily understand the new features from this site. This is a must visit site for every .NET professional.

ToggleDebugCompilation fails trying to perform "an unauthorised operation"



We're having a problem with the Visual Studio 2008 RTW version of the web deployment projects on a colleagues machine. The project works fine if I run it on my machine, but when he tries to run it on his machine he gets:

<SNIP : Most output removed>
  Task "Exec"
    if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"
  Done executing task "Exec".
  Using "ToggleDebugCompilation" task from assembly "C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.Tasks.dll".
  Task "ToggleDebugCompilation"
    Updating Web.config <compilation> element debug attribute to 'True'.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(639,7): error : Attempted to perform an unauthorized operation.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(639,7): error MSB4018: The "ToggleDebugCompilation" task failed unexpectedly.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(639,7): error MSB4018: System.ArgumentNullException: Parameter "message" cannot be null.
    C:\Program Files\MSBuild\Microsoft\WebDeployment

ArrayList.ToArray fails!


In my app, I have code similar to the following:



               ArrayList alStartFrames = new ArrayList();
                byte[] abytTest = { 1, 2 };


                byte[] abytCombinedFrame = (byte[])alStartFrames.ToArray(typeof(byte));

            catch (Exception ex)

The call to ToArray always fails and the exception is caught even though I'm pretty sure alStartFrames is an array list of byte arrays. Anyone have any insight on why this is happening?! TIA

routing fails



I am trying to compile and run an asp.net application and am getting the following errors

 HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

I have a starting URL of http://localhost:61431/WebSuds/Suds/Welcome and routing code

"Default",                                 // Route name
"{controller}/{action}/{page}",            // URL with parameters
new { controller = "Suds", action = "Welcome",

Using Infopath form fieldnames in a workflow fails



I designed a form in Infopath and I published it on a SP2007 server to use in a workflow in a library. That goes fine. In the workflow I send an email message. I can use the fields from my Infopath form in the message that I create. 
If the workfow is starts, Shrepoints sends me the message. But it does not use the fields from my InfoPtah form in the message in stead I see questionmarks.

Why doesn't it show the fields?

I alse saw (maybe this makes it clear) that when I let it dipslay the URL in the message, it show: http://1.portal.lucasonderwijs, but the actual site is whithout the "1" and it should also start with https://

Has anyone seen this before?

Thank you,


Crawler fails to register date properties of user profiles with the month of January, April, August


This seems to be a bug when the crawler search the user profiles in MOSS 2007.  When crawled, user profiles with a SPS-HireDate in the months of January, April, August and December will be detected, but a full-text (SQL) search returns those profiles without the HireDate field.

User profiles with HireDates in other months work correctly, returning the HireDate in the search.  And changing the month of a problematic user profile also fixes the problem.

This problem is also reflected in the fact that while we have 499 user profiles using the SPS-HireDate property,  the managed property page from the search section only has 350 items with the HireDate property.

We're running MOSS 2007 32bit with SP2 with an English language base and the Spanish language pack. I'd considered date format problems, but I can't imagine how some months would work, while others wouldn't.

Any ideas?

Javascript fails in chrome and firefox, works fine in IE



I am customizing Newform.aspx i.e. hiding some fields, making other readonly etc. It works fine in IE but fails miserably in chrome and firefox i.e. readonly are no more readonly, hidden are no more hidden. Here is my code:

<script language="javascript" type="text/javascript">
    function autoFillFields()
       var ctrl = findacontrol("Reference Customer");
    var param = getURLParam('RefFromCust');   
    var properParam = replaceCharacters(param);
    ctrl.value = properParam;
    var ctrl = findacontrol("RefReqOpptyId");
    var param = getURLParam('OpptyId');   
    var properParam = replaceCharacters(param);
    ctrl.value = properParam;

    param = getURLParam('RefFromAE');
    properParam = replaceCharacters(param);
    setPeoplePicker("People Picker", properParam);
    hideFldCtrl("Approval Sta

.NET4, DataGrid doesn't apply EditingElementStyle with ValidatesOnExceptions when catching an excep

Hello everyone, I'm using WPF and the .NET 4 framework (4.3.30319), on the Windows 7 32-bit OS. I wanted to keep things simple with validation and my property setter just throws an ArgumentException when the data is not valid, instead of implementing a ValidationRule class. While this worked with a ListBox, it seems it doesn't with a DataGrid. Below is a simple example to reproduce the problem, check the XAML and C# code related to the 2nd column. The datagridTBStyle is meant to apply a specific style when an error occurs (since control templates are out of the question with DataGrid), but what I see is: it applies the correct style when editing the cell (blue text) it doesn't apply the part that is supposed to trigger on Validation.HasError (red on yellow background + tooltip) Without this style, it doesn't apply a red border around the cell as it should according to the documentation. However, it does put a part of red exclamation mark in the row header when an error occurs, and it catches the exception. Am I doing something wrong, or is this actually a bug? Link to the documentation. <Window x:Class="DataGridTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test" Height="200" Width="350&q

DateTime custom managed property search fails with " Your query is malformed. Please rephrase your q

I've created a front end search page in Silverlight 4 for SharePoint Search.  Currently we are using WSS 3.0 + Search Server Express 2008 (v  The page interacts with the MOSS version of the search web service at:   <site collection>/_vti_bin/search.asmx The reason for this approach is the unique way the requirements specify the look and behavior of the results.  The built-in Search Center page or web parts will not satisfy these requirements. We are going into production but I still cannot figure out how to search against my custom managed properties that are of Type DateTime.  If I cannot get this to work, it is a showstopper. I've tried numerous variations on the SQL Syntax and cannot get it to work.  I know the error is in the date portion of the WHERE clause since I can remove it and searches work fine. Here is a working query: SELECT Size, Rank, Path, Title, Description, Write, RequestSubmittedDate, DocumentType, RequestPromisedDate, ProblemDescription, DatePublished, RequestOwner, RequestingDepartment, DocumentAuthor, ProjectNumber, ProjectDescription, RequestStatus FROM scope() WHERE CONTAINS ('"nmr"') ORDER BY "Rank" DESC yet if I try to use a date literal in the WHERE clause as in the following query modification, I get the "malformed"


I have a requirement that a user can upload as many files as he wish. So i am dynamically generating <input type="file"... and embedding them into form tag, Once user clicks submit button. I see that nothing is uploaded to aspx page. The post data looks like this   -----------------------------19718198955447 Content-Disposition: form-data; name=""; filename="" Content-Type: application/octet-stream You can see that the filename is blank and file content is not posted.   I have set the enctype of my form to 'multipart/form-data', but still the problem persists.   Can someone tell me whats the issue here?    suneeelid2000@gmail.co

SendInput fails to control mouse in x64

I am currently working on a project in which I'm trying to make a program which can input mouse movements to click and drag objects. I've imported user32.dll and created my inputs exactly as the help info and pinvoke.net instruct so as to be able to send mouse inputs. Nevertheless, whenever I implement the SendInput function, it always returns that it successfully inserted 0 events into the keyboard and mouse input stream and when I run GetLastError, it gives me error 1400 INVALID_WINDOW_HANDLE. I've tried the same code on two different systems, both running in x64. One is XP and the other is Windows 7. Neither works. If you're interested in the code, it's basically a 64-bit version of Johnny Chung Lee's Wiimote Whiteboard program. I've made a few modifications, but the main gruntwork of the program is the same as his original. His stuff can be found here: http://johnnylee.net/projects/wii/

SQL Null Insert fails

I am developing an SSIS package and trying to update an existing table with info from new columns.  In other words, this table already has records for my input CSV file.  But this CSV file has additional columns for these same records.  So I need to keep existing columns in table.  How can I achieve this? I began by using Import/Export Wizard and it did most of hard work for me.  But one of the columns previously defined in this table doesn't allow NULLs.  So although I want these new rows to map into existing table, it seems like this will just overwrite the table values and I get the error below.  How can I fix this? I have a Flat File CSV source, Data Conversoin, and DestinationConnectionOLEDB Error: 0xC0202009 at Data Flow Task 1, Destination - j5c_ALL_DATA2 [138]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Cannot insert the value NULL into column 'timestamp', table 'berkeley.dbo.j5c_ALL_DATA2'; column does not allow nulls. INSERT fails.". Error: 0xC0209029 at Data Flow Task 1, Destinati

How to Get Error Message from Job History if SQLAgent Job Fails

Hello, I am using "last_run_outcome" value = 0 (fail) or 1 (pass)  from sysjobsteps to identify if the job has failed. So if the job has failed, can I get the Error Message from SQL ? (which we can see in Job History). Thanks, Prabhat
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend