473,395 Members | 1,676 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.

socket connection open for a long time

Jay
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
once in the morning - close at the end of the day?
Is it just a matter of moving the code around to achive this?
Like, create the socket at the application start. Then "send message"
multiple times during the day. At the end of the day, when the app closes,
"close socket"?
Are there going to be any issues with this?
Feb 15 '07 #1
1 6325

You can keep it open for a day or however long. Some issues to deal
with:

1. Silently handle reconnect on disconnect. Only treat as error if
can't reconnect.

2. Perhaps want to disconnect and reconnect if socket has been
connected for a certain amount of time (say max 8 hours). Not sure
this is necessary, but may be good. We have systems that used to
maintain open FTP server connections 24/7 and they mostly didn't have
problems (the one installation we had a problem with was a switch
which was specifically programmed to disconnect our socket 'cause the
IT people didn't want an open socket that long).

3. Timeout. If socket isn't used for x minutes then close the socket.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Thu, 15 Feb 2007 10:40:24 -0600, "Jay" <Ja*@microsoft.comwrote:
>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
once in the morning - close at the end of the day?
Is it just a matter of moving the code around to achive this?
Like, create the socket at the application start. Then "send message"
multiple times during the day. At the end of the day, when the app closes,
"close socket"?
Are there going to be any issues with this?
Feb 15 '07 #2

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

Similar topics

0
by: Hameed Khan | last post by:
hi all, i am getting some problems with my first socket script. can any one of you point me why this is happening. the server script suppose to accept one connection at a time and send countdown...
9
by: AA | last post by:
This is making me crazy!! Please, if some body can help me. I'm testing a ver simple socket client. In my test I just open and close a connection (in a loop) to my local IIS server (port 80)...
1
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows...
4
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
6
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...
5
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable...
2
by: Nicolas Le Gland | last post by:
Hello everyone here. This is my first post in this newsgroup, I hope I won't be to much off-topic. Feel free to redirect me to any better group. I am getting strange timing issues when...
2
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...
0
by: kuguy | last post by:
Hi all, I'm new to the forums, so I hope this isn't in the wrong place... I have that "Software caused connection abort: socket write error" exception error that i've never meet before. ...
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:
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...
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...
0
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...
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.