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

Tcp reconnection

Hi,

I am working on a project where some PCs are sending messages via Tcp
sockets.
When the Tcp connection is down (cable unplugged) I detect it using WMI.
When the connection is back, it does not mean that I can immediately send
data.
My question is : is there any event that I can trigger when I can send data
again ?
If no, what is the best way to handle this (retries, ...) ?

Thanks in advance,

Droopy.
Nov 17 '05 #1
5 2992
Hi,
When the Tcp connection is down (cable unplugged) I detect it using WMI.
You dont need that really, just check if you can connect or not, a
connection may be down because a lot more thing beside you disconnect your
cable, what if it's the router where the cable is disconnecteD?
When the connection is back, it does not mean that I can immediately send
data.
Well, first you need to restablish the connection, the other ends need to be
aware of it too, in a similar way the other end should check for connection
errors

If no, what is the best way to handle this (retries, ...) ?


Yes, retries is the best (if not the only) solution here

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Nov 17 '05 #2
"Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
wrote in news:#m**************@TK2MSFTNGP11.phx.gbl:
Hi,
When the Tcp connection is down (cable unplugged) I detect it using
WMI.
You dont need that really, just check if you can connect or not, a
connection may be down because a lot more thing beside you disconnect
your cable, what if it's the router where the cable is disconnecteD?


True, I want to handle all communication errors
When the connection is back, it does not mean that I can immediately
send data.


Well, first you need to restablish the connection, the other ends need
to be aware of it too, in a similar way the other end should check for
connection errors


The problem is that the other ends does not see there is a problem, at
least before a timeout elapsed, if it does not send data.
If no, what is the best way to handle this (retries, ...) ?
Yes, retries is the best (if not the only) solution here


OK I will try this way.
It does not seems trivial at first look !

cheers,


Thanks a lot for your help.
Nov 17 '05 #3
Droopy <dr**************@hotmail.com> wrote in
news:Xn**********************************@195.129. 110.71:
"Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
wrote in news:#m**************@TK2MSFTNGP11.phx.gbl:
Hi,
When the Tcp connection is down (cable unplugged) I detect it using
WMI.


You dont need that really, just check if you can connect or not, a
connection may be down because a lot more thing beside you disconnect
your cable, what if it's the router where the cable is disconnecteD?


True, I want to handle all communication errors
When the connection is back, it does not mean that I can immediately
send data.


Well, first you need to restablish the connection, the other ends need
to be aware of it too, in a similar way the other end should check for
connection errors


The problem is that the other ends does not see there is a problem, at
least before a timeout elapsed, if it does not send data.


I need a "keep alive" system.
I know Tcp has it but the default is 2 hours.
I am displaying the status of the connection and I would like to be
notified within a few seconds when the connection is down.
Should I do it by myself (sending a kind of ping message) or can I set
the Tcp keep alive value to a few seconds ?

Thanks in advance for any help.
If no, what is the best way to handle this (retries, ...) ?


Yes, retries is the best (if not the only) solution here


OK I will try this way.
It does not seems trivial at first look !

cheers,


Thanks a lot for your help.


Nov 17 '05 #4
http://tangentsoft.net/wskfaq/newbie.html#abnormalclose
See 2.12 and 2.13

--
William Stacey [MVP]

"Droopy" <dr**************@hotmail.com> wrote in message
news:Xn**********************************@195.129. 110.71...
Droopy <dr**************@hotmail.com> wrote in
news:Xn**********************************@195.129. 110.71:
"Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
wrote in news:#m**************@TK2MSFTNGP11.phx.gbl:
Hi,

When the Tcp connection is down (cable unplugged) I detect it using
WMI.

You dont need that really, just check if you can connect or not, a
connection may be down because a lot more thing beside you disconnect
your cable, what if it's the router where the cable is disconnecteD?


True, I want to handle all communication errors
When the connection is back, it does not mean that I can immediately
send data.

Well, first you need to restablish the connection, the other ends need
to be aware of it too, in a similar way the other end should check for
connection errors


The problem is that the other ends does not see there is a problem, at
least before a timeout elapsed, if it does not send data.


I need a "keep alive" system.
I know Tcp has it but the default is 2 hours.
I am displaying the status of the connection and I would like to be
notified within a few seconds when the connection is down.
Should I do it by myself (sending a kind of ping message) or can I set
the Tcp keep alive value to a few seconds ?

Thanks in advance for any help.

If no, what is the best way to handle this (retries, ...) ?

Yes, retries is the best (if not the only) solution here


OK I will try this way.
It does not seems trivial at first look !

cheers,


Thanks a lot for your help.

Nov 17 '05 #5
"William Stacey [MVP]" <st*****@mvps.org> wrote in news:eEipDtkqFHA.2776
@TK2MSFTNGP10.phx.gbl:
http://tangentsoft.net/wskfaq/newbie.html#abnormalclose


I knew this faq but I did not look at it for a while !

Thanks a lot, I will read it and think about it thoroughly.

Nov 17 '05 #6

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

Similar topics

3
by: comp.lang.php | last post by:
I'm having a serious problem in my application I simply cannot seem to fix, and it has to do with multiple inheritances whereby something is lost. Class EditView is a child of PagOptionsView...
4
by: Jay O'Connor | last post by:
I'm using Python 2.3 on windows and trying to use the win32 libs. I keep getting the following error >>> import win32gui Traceback (most recent call last): File "<pyshell#6>", line 1, in...
2
by: Storm | last post by:
.... that I would like to use in a client/server application that would : 1) detect reliably when connection is lost and try automatically to reconnect to the server and the link is declared...
2
by: Damjan | last post by:
Does MySQLdb automatically reconnect if the connection to the database is broken? I'm asking this since I have a longrunning Python precess that is connected to Mysql-4.1.11, and I execute "set...
3
by: Josh Schmidt | last post by:
How can one set the terminal services profile and home directory path in AD using VB.NET? I can set the usual profile paths, but terminal services properties are not supported with ADSI. Any...
0
by: Emanuele | last post by:
I have write a program using MS Visual studio C++ 7.0 (platform Windows XP professional). I'm not using .NET. This program save data in a SQL server 2000 database using ADO. Everything works...
0
by: =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post by:
Hello, First of all I wish you a good day. My help request is about .NET asynchrounus socket communication. I have developed Server-Client Windows Forms .NET applications in VC++ .NET v2003. I...
1
by: sreejithp | last post by:
Hello, I am new to python. I have been trying to connect to telnet and feed some data from a server. Its working properly. I used the connectionObj.read_until() method to read the data from the...
8
n8kindt
by: n8kindt | last post by:
hi guys, i am also posting this question in the MySQL forum but am putting the detailed post on here. here is the message i am having problems with: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.