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

TCP/IP responding to closed connection

bob
Hi,

I have a C# TCP/IP host which talks to a piece of proprietary
hardware.

When certain events occur on the hardware it closes it's TCP/IP
connection which results in [FIN, ACK] being sent to the TCP/IP stack
on my host. However, the hardware will not proceed to its next state
until it gets a [FIN] back.

My problem is that I can't see a way in my C# program of determining
that the remote client closed its connection.

I read the data in a loop with this piece of code.

if (_Socket.Available > 0) {
int read = _Socket.Receive(dataBytes, _Socket.Available,
SocketFlags.None);
....
}

where _Socket is my open socket connected to the hardware.

Is there anything I can do there to spot the fact that the remote
client has closed the connection, so that I can close my end of the
connection (which will send the [FIN] which the client expects)?

Alternatively, is there a way to configure the socket so that it
automatically closes when it receives [FIN] from the client?

Many thanks for any help you can offer.

Regards,
Bob.
Jul 21 '05 #1
0 915

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

Similar topics

3
by: Lubomir | last post by:
Hi, I have a class A with a public method GetReader: public OleDbDataReader GetReader() { SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings); SqlCommand...
15
by: Rob Nicholson | last post by:
I'm starting to worry a bit now. We're getting the above error when two users hit the same database/page on an ASP.NET application using ADO.NET, talking to a SQL 7 server. The error is perfectly...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
0
by: bob | last post by:
Hi, I have a C# TCP/IP host which talks to a piece of proprietary hardware. When certain events occur on the hardware it closes it's TCP/IP connection which results in being sent to the...
2
by: Nuno Magalhaes | last post by:
How to check for a closed http socket without losing any data? (MSDN says to send something to server). Somewhere in my code (after sending the http header in plain text) I'm doing a loop with:...
6
by: billiejoex | last post by:
Hi there. I'm setting up test suite for a project of mine. situations, if the socket is closed on the other end or not. I noticed that I can "detect" such state if a call to socket.read() returns...
4
by: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= | last post by:
Hi all, we meet a problem since we use WCF to consume java WebServices. Often the first call works then the second raises the following error : "The underlying connection was closed : " We...
4
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http://...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.