473,700 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Socket reconnect problem

37 New Member
Hello everybody

I am working on a client application that connects to a C# server using the Socket class. I am trying to handle the case in which the server goes offline, and I would like the client to try to reconnect after the previous connect times out.

Currently I try to re-connect on the IOErrorEvent.IO _ERROR event handler. The issue is that it seems like the socket is not trying to make another connection.

I've seen the following post http://stackoverflow.c om/questions/8939/actionscript-3-0-sockets-cant-reconnect , but I was wondering if somebody knows a method for achieving socket reconnection, or a good way to handle situations in which server is unavailable.

Thanks in advance
Dec 11 '09 #1
0 2340

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

Similar topics

3
2648
by: Thomas Hervé | last post by:
My problem is not really python specific but as I do my implementation in python I hope someone here can help me. I have two programs that talk through a socket. Here is the code : <server> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.settimeout(5.0)
6
3547
by: Sharon | last post by:
Hi all. I'm trying first time async socket connection. In all the examples i've seen, the server connection is closed when the message is complete. Is it common to close the connection after every message? Also, the message is complete, meaning there is no more data to read, only when the client closes the connection. My solution is to keep the connection open, and send a terminator / eof at the end of every message. Is it the right...
18
64295
by: nephish | last post by:
lo there, i have a simple app that connects to a socket to get info from a server i looks like this serverhost = 'xxx.xxx.xxx.xxx' serverport = 9520 aeris_sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM) aeris_sockobj.connect((serverhost,serverport))
1
6372
by: Jay | last post by:
I have a client app sending messages over the socket on a certain port. In the client app: I do this for every message I need to send: 1. Create a socket and connect. 2. Send message 3. Close socket. The Listener requires that the client keep the socket connected while sending messages..which is every 20-30 seconds. My question is: Can I keep the connection open for the whole day? Connect
0
1373
by: Kursat | last post by:
Hi, I developed a socket client application which connects to a server application and axchange some data. I test Connected property of the socket object and try to reconnect if its value is false before send any data. But if Connected property is false and I try to connect to same server(endpoint) a strange error occurs saying something like "You can only connect asynchronously to same endpoint via discconnected socket because of...
15
8399
by: dennis.richardson | last post by:
Greetings all. Here's a problem that's been driving me nuts for the last 48 hours. I'm hoping that someone has come across this before. I have a C# Application that reads a UDP broadcast (asynchronously). Then it repackages these UDP packets and sends them to a subscriber via TCP. Now, I can read the UDP stream all day long without the application
6
10290
by: Diego F. | last post by:
Hello. I'm writing an application that manages sockets and has a message protocol. I connect to another machine and I have to send and receive certain messages. I need the possibility to restart the communication. I tried with a simple socket.close method and trying to connect again as the first time, but the connection is refused.
2
4338
by: dougmcmurtry | last post by:
I have an Asynchronous socket that sends data to a server for credit card approvals. The socket is kept alive by the server through a heartbeat that sends a "beat" every 90 seconds. Trouble is that the network is unreliable at times and thus the server will drop my connection from time to time. I need to code around this so I can reconnect to the server whenever this happens. THE PROBLEM: The Connected, Poll, and Available properties...
3
8457
by: Jason Kristoff | last post by:
I'm trying to make something that once it is disconnected will automatically try to reconnect. I'll add some more features in later so it doesn't hammer the server but right now I just want to keep it simple and get that part working. The problem is that when I use sock.close I get an error message of Bad File Descriptor and if I either use shutdown or just go straight to reconnecting I get: Transport endpoint is already connected ...
0
8718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8963
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8916
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4400
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2383
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2022
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.