473,379 Members | 1,190 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,379 software developers and data experts.

SocketOption ReceiveTimeOut

now lets take a secnario where we use a locking socket receive and the packet is 5000 bytes with receivetimeout set to one second

s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 1000);

int bytes_recevied = 0 ; byte [] ReceiveBuffer = new byte[8192] ;

try { bytes_received = s.Receive(RecevieBuffer) ; } catch(SocketException e) { if( e.ErrorCode == 10060) { Array.Clear(ReceiveBuffer,0,ReceiveBuffer.Length); } }

now our secnario dictates that 4000 bytes have gone threw alreadys,the socket is still blocking and some error accured on the receiving end , now on the receiving end we would handly dispose of the 4000 bytes by catching the socket ecxecption

is there any guaranty that the socket on the sending end wont thows 1000 bytes that remain does the sending socket know to truncate them if he wasent disconnected when we attempt to receive again wont they be the first bytes we receive ?

what im asking is : a) does tcp have some mecanisem that tells the socket to dispose of the rest of them message ? is there a socket flag that we could send or receive with that tells the buffers to dispose of the rest of the message ?
Feb 12 '11 #1
0 1107

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nathan Kerr | last post by:
I have been working with KB Article 812404 "HOW TO: Write Pluggable Protocol to Supprot FTP in Managed Classes by Using Visual Bassic.NET". I have modified the code to run on a Pocket PC. In the...
0
by: Ivar | last post by:
Hi, Is SocketOption.NoDelay working ? There is some trouble with socket delay, I doubt that SocketOption.NoDelay isn't working. If I set...
2
by: Milosz - [playseven.com] | last post by:
Dim EP As System.Net.IPEndPoint = New System.Net.IPEndPoint(mIP, mPort) Dim S As Socket = New Socket(EP.AddressFamily, SocketType.Dgram, ProtocolType.Udp) ...
6
by: roger beniot | last post by:
I have a program that launches multiple threads with a ThreadStart method like the following (using System.Net.Sockets.Socket for UDP packet transfers to a server): ThreadStart pseudo code: ...
0
by: Mark G. Zeringue | last post by:
We are new to dotnet and C#. One of the functions we need to do is port over an existing Delphi application to C#, this application uses a protocol based on UDP. Basically, a packet is sent and...
1
by: Sagaert Johan | last post by:
Hi Ii have a simple server thread in an app that listens for connections, for some unclear reason an exception is thrown every now and then : 'A blocking operation was interrupted by a call to...
2
by: djc | last post by:
I read a network programming book (based on framework 1.1) which indicated that you should 'never' use the RecieveTimeout or the SendTimeout 'socket options' on TCP sockets or you may loose data. I...
9
by: nephish | last post by:
lo there all ! i have a huge delima, i have to be able to connect to a data server and recieve info from it. The servers software guys release some visual C++ modules that one can incorporate...
0
by: arunakoride | last post by:
Hi I am trying to set SocketOption in Windows Mobile Application, but its throwing Exception. Please let me know how to set Receive Time out for socket in Windows Mobile VS2005 application. ...
1
by: David | last post by:
VS 2005 help says they are only for the synchronous send and receive methods. So what about the asynchronous calls? How are timeouts handled?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.